X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frest%2Fitem.t;h=dea2b880f34ed58c09cda81c7a4a2f5400dbc59d;hb=33a4e523181d12869b80a659c75a4fa90853afd3;hp=3b075aa936bf20f512c470ab328050999769ecac;hpb=a5bf6db237f004118bb8743ac941458946b21473;p=catagits%2FCatalyst-Controller-DBIC-API.git diff --git a/t/rest/item.t b/t/rest/item.t index 3b075aa..dea2b88 100644 --- a/t/rest/item.t +++ b/t/rest/item.t @@ -23,7 +23,7 @@ my $artist_view_url = "$base/api/rest/artist/"; { my $id = 1; my $req = - GET( $artist_view_url . $id, undef, 'Accept' => 'application/json' ); + GET( $artist_view_url . $id, 'Accept' => 'application/json' ); $mech->request($req); cmp_ok( $mech->status, '==', 200, 'open attempt okay' ); my %expected_response = @@ -39,7 +39,7 @@ my $artist_view_url = "$base/api/rest/artist/"; { my $id = 5; my $req = - GET( $artist_view_url . $id, undef, 'Accept' => 'application/json' ); + GET( $artist_view_url . $id, 'Accept' => 'application/json' ); $mech->request($req); cmp_ok( $mech->status, '==', 400, 'open attempt not ok' ); my $response = $json->decode( $mech->content ); @@ -57,7 +57,7 @@ my $track_view_url = "$base/api/rest/track/"; { my $id = 9; my $req = - GET( $track_view_url . $id, undef, 'Accept' => 'application/json' ); + GET( $track_view_url . $id, 'Accept' => 'application/json' ); $mech->request($req); cmp_ok( $mech->status, '==', 200, 'got track with datetime object okay' ); my %expected_response = @@ -70,4 +70,17 @@ my $track_view_url = "$base/api/rest/track/"; ); } +{ + my $req = + GET( $artist_view_url . 'action_with_error', 'Accept' => 'application/json' ); + $mech->request($req); + cmp_ok( $mech->status, '==', 404, 'action returned error 404' ); + my $response = $json->decode( $mech->content ); + is_deeply( + $response, + { success => 'false' }, + 'correct data returned' + ); +} + done_testing();