Description
Tomás Cohen Arazi (tcohen)
2020-05-21 14:32:48 UTC
Created attachment 105229 [details] [review] Bug 25570: Regression tests This tests verify that the default behaviour is to paginate the results. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: $c->objects->search doesn't paginate results by default Created attachment 105230 [details] [review] Bug 25570: Paginate results by default in objects->search This patch makes the helper paginate the resultsif no pagination parameters are passed. Page number defaults to 1, and the page size to the RESTdefaultPageSize syspref value. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Pagination is not enforced by default 3. Apply this patch 4. Repeat 2 => SUCCESS: Results are paginated 5. Sign off :-D Created attachment 105231 [details] [review] Bug 25570: (follow-up) Fix tests This patch fixes the libraries tests, that expected the old behaviour To test: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/libraries.t => FAIL: Tests fail 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! 4. Sign off :-D Created attachment 105248 [details] [review] Bug 25570: Regression tests This tests verify that the default behaviour is to paginate the results. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: $c->objects->search doesn't paginate results by default Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 105249 [details] [review] Bug 25570: Paginate results by default in objects->search This patch makes the helper paginate the resultsif no pagination parameters are passed. Page number defaults to 1, and the page size to the RESTdefaultPageSize syspref value. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Pagination is not enforced by default 3. Apply this patch 4. Repeat 2 => SUCCESS: Results are paginated 5. Sign off :-D Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 105250 [details] [review] Bug 25570: (follow-up) Fix tests This patch fixes the libraries tests, that expected the old behaviour To test: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/libraries.t => FAIL: Tests fail 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! 4. Sign off :-D Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> I think we should target 20.05.01 for this one. Created attachment 106070 [details] [review] Bug 25570: Regression tests This tests verify that the default behaviour is to paginate the results. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: $c->objects->search doesn't paginate results by default Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 106071 [details] [review] Bug 25570: Paginate results by default in objects->search This patch makes the helper paginate the resultsif no pagination parameters are passed. Page number defaults to 1, and the page size to the RESTdefaultPageSize syspref value. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Pagination is not enforced by default 3. Apply this patch 4. Repeat 2 => SUCCESS: Results are paginated 5. Sign off :-D Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 106072 [details] [review] Bug 25570: (follow-up) Fix tests This patch fixes the libraries tests, that expected the old behaviour To test: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/libraries.t => FAIL: Tests fail 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! 4. Sign off :-D Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Works as expected, tests pass, qa script passes.. Passing QA Pushed to master for 20.11, thanks to everybody involved! Tomas, if "all" is selected we get an error: [2020-06-25 07:58:51.08130] [2024] [debug] Routing to controller "Koha::REST::V1::Libraries" and action "list" No method pager found for Koha::Libraries Fewer than one entry per page! at /usr/share/perl5/DBIx/Class/ResultSet.pm line 2542. at /kohadevbox/koha/Koha/REST/Plugin/Objects.pm line 127. [2020-06-25 07:58:51.10649] [2024] [debug] 500 Internal Server Error (0.053242s, 18.782/s) Caught by Jenkins on Master_D9 run #1375, t/db_dependent/selenium/administration_tasks.t Created attachment 106277 [details] [review] Bug 25570: Allow "all", -1 Is this patch correct? It fixes the problem. I did not manage to find a good place for the tests. Should it be in t/Koha/REST/Plugin/Pagination.t, t/db_dependent/Koha/REST/Plugin/Objects.t or both? backported to 20.05.x for 20.05.02 backported to 19.11.x for 19.11.08 Backported to 19.05.x branch for 19.05.14 (In reply to Jonathan Druart from comment #13) > Tomas, if "all" is selected we get an error: > > [2020-06-25 07:58:51.08130] [2024] [debug] Routing to controller > "Koha::REST::V1::Libraries" and action "list" > No method pager found for Koha::Libraries Fewer than one entry per page! at > /usr/share/perl5/DBIx/Class/ResultSet.pm line 2542. > > at /kohadevbox/koha/Koha/REST/Plugin/Objects.pm line 127. > [2020-06-25 07:58:51.10649] [2024] [debug] 500 Internal Server Error > (0.053242s, 18.782/s) > > Caught by Jenkins on Master_D9 run #1375, > t/db_dependent/selenium/administration_tasks.t This was caught in the wild, and I solved it on bug 26143, before noticing this comment. Sorry dude. |