Bugzilla – Attachment 107839 Details for
Bug 26143
The API does not handle requesting all resources
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26143: The API is always paginated
Bug-26143-The-API-is-always-paginated.patch (text/plain), 2.71 KB, created by
Jonathan Druart
on 2020-08-05 15:35:03 UTC
(
hide
)
Description:
Bug 26143: The API is always paginated
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-05 15:35:03 UTC
Size:
2.71 KB
patch
obsolete
>From 78d4321f71a0b4c705ec1bfe6b373de60f30cf60 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 5 Aug 2020 11:55:28 -0300 >Subject: [PATCH] Bug 26143: The API is always paginated > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/Koha/REST/Plugin/Pagination.t | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > >diff --git a/t/Koha/REST/Plugin/Pagination.t b/t/Koha/REST/Plugin/Pagination.t >index 43e9f072f2..adf3001c4f 100644 >--- a/t/Koha/REST/Plugin/Pagination.t >+++ b/t/Koha/REST/Plugin/Pagination.t >@@ -66,7 +66,7 @@ get '/pagination_headers_without_page_size' => sub { > > get '/pagination_headers_without_page' => sub { > my $c = shift; >- $c->add_pagination_headers({ total => 10, params => { _per_page => 4, firstname => 'Jonathan' } }); >+ $c->add_pagination_headers({ total => 10, params => { _per_page => 3, firstname => 'Jonathan' } }); > $c->render( json => { ok => 1 }, status => 200 ); > }; > >@@ -79,7 +79,7 @@ use t::lib::Mocks; > > subtest 'add_pagination_headers() tests' => sub { > >- plan tests => 64; >+ plan tests => 75; > > my $t = Test::Mojo->new; > >@@ -151,10 +151,19 @@ subtest 'add_pagination_headers() tests' => sub { > > $t->get_ok('/pagination_headers_without_page') > ->status_is( 200 ) >- ->header_is( 'X-Total-Count' => undef, 'X-Total-Count header absent' ) >- ->header_is( 'Link' => undef, 'Link header absent' ); >- >- >+ ->header_is( 'X-Total-Count' => 10, 'X-Total-Count header present, even without page param' ) >+ ->header_unlike( 'Link' => qr/<http:\/\/.*\?.*per_page=3.*>; rel="prev",/, 'First page, no previous' ) >+ ->header_unlike( 'Link' => qr/<http:\/\/.*\?.*page=1.*>; rel="prev",/, 'First page, no previous' ) >+ ->header_unlike( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="prev",/, 'First page, no previous' ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=3.*>; rel="next",/ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*page=3.*>; rel="next",/ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="next",/ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=3.*>; rel="first",/ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*page=1.*>; rel="first",/ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="first",/ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*per_page=3.*>; rel="last"/ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*page=4.*>; rel="last"/ ) >+ ->header_like( 'Link' => qr/<http:\/\/.*\?.*firstname=Jonathan.*>; rel="last"/ ); > }; > > subtest 'dbic_merge_pagination() tests' => sub { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26143
:
107836
|
107837
|
107838
| 107839 |
107840
|
107841