X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-DBIC-API.git;a=blobdiff_plain;f=t%2Frest%2Flist.t;h=7d8c68f02b33930f957942569fdcea575dcc19b1;hp=6d73b59b3feead8693dafb91ea3c268a5541a1a7;hb=4a805f62625bb1e4152fd2ef25169ac6683ca611;hpb=04f135e4176ab36780d168136947d1a748178ca7 diff --git a/t/rest/list.t b/t/rest/list.t index 6d73b59..7d8c68f 100644 --- a/t/rest/list.t +++ b/t/rest/list.t @@ -22,6 +22,7 @@ my $artist_list_url = "$base/api/rest/artist"; my $filtered_artist_list_url = "$base/api/rest/bound_artist"; my $producer_list_url = "$base/api/rest/producer"; my $cd_list_url = "$base/api/rest/cd"; +my $track_list_url = "$base/api/rest/track"; # test open request { @@ -121,4 +122,18 @@ my $cd_list_url = "$base/api/rest/cd"; is_deeply( $response, { list => \@expected_response, success => 'true' }, 'correct data returned for multiple search params' ); } +# page specified in controller config (RT#56226) +{ + my $uri = URI->new( $track_list_url ); + $uri->query_form(); + my $req = GET( $uri, 'Accept' => 'text/x-json' ); + $mech->request($req); + cmp_ok( $mech->status, '==', 200, 'get first page ok' ); + my $response = JSON::Any->Load( $mech->content); + my @expected_response = map { { $_->get_columns } } $schema->resultset('Track')->search(undef, { + page => 1, + })->all; + is_deeply( $response, { list => \@expected_response, success => 'true', totalcount => 15 }, 'correct data returned for static configured paging' ); +} + done_testing();