add 403 Forbidden
[catagits/Catalyst-Action-REST.git] / t / lib / Test / Catalyst / Action / REST / Controller / REST.pm
CommitLineData
0ba73721 1package Test::Catalyst::Action::REST::Controller::REST;
2
930013e6 3use Moose;
4use namespace::autoclean;
0ba73721 5
930013e6 6BEGIN { extends 'Catalyst::Controller::REST' }
0ba73721 7
8sub test : Local {
9fb09119 9 my ( $self, $c ) = @_;
10 $self->status_ok( $c,
11 entity => { test => 'worked', data => $c->req->data } );
12}
13
14sub test_status_created : Local {
15 my ( $self, $c ) = @_;
16 $self->status_created(
17 $c,
18 location => '/rest',
19 entity => { status => 'created' }
20 );
21}
22
bdff70a9 23sub test_status_multiple_choices : Local {
24 my ( $self, $c ) = @_;
25 $self->status_multiple_choices(
26 $c,
27 location => '/rest/choice1',
28 entity => { choices => [qw(/rest/choice1 /rest/choice2)] }
29 );
30}
31
9fb09119 32sub test_status_accepted : Local {
33 my ( $self, $c ) = @_;
34 $self->status_accepted( $c, entity => { status => "queued", } );
35}
36
37sub test_status_no_content : Local {
38 my ( $self, $c ) = @_;
39 $self->status_no_content($c);
40}
41
42sub test_status_bad_request : Local {
43 my ( $self, $c ) = @_;
44 $self->status_bad_request( $c,
45 message => "Cannot do what you have asked!", );
46}
47
550807bc 48sub test_status_forbidden : Local {
49 my ( $self, $c ) = @_;
50 $self->status_forbidden ( $c,
51 message => "access denied", );
52}
53
9fb09119 54sub test_status_not_found : Local {
55 my ( $self, $c ) = @_;
56 $self->status_not_found( $c,
57 message => "Cannot find what you were looking for!", );
58}
59
60sub test_status_gone : Local {
61 my ( $self, $c ) = @_;
62 $self->status_gone( $c,
63 message => "Document have been deleted by foo", );
0ba73721 64}
65
661;