Bugzilla – Attachment 117391 Details for
Bug 27680
API DataTables Wrapper fails for ordering on multi-data-field columns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27680: Add tests for various ways of passing multi-params
Bug-27680-Add-tests-for-various-ways-of-passing-mu.patch (text/plain), 3.65 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-02-26 18:09:41 UTC
(
hide
)
Description:
Bug 27680: Add tests for various ways of passing multi-params
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-02-26 18:09:41 UTC
Size:
3.65 KB
patch
obsolete
>From da0ab664ce590f001fc2b6524abcce8130168870 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 12 Feb 2021 14:05:13 +0000 >Subject: [PATCH] Bug 27680: Add tests for various ways of passing multi-params > >This patch adds unit test to increase the coverage of parameter that >accept multiple values. There are a number of different ways end users >can send such parameters and we should test to ensure we are recieving >the correct option. > >Options >`?param1=this¶m1=that` - traditional multiple pass params >`?param1[]=this¶m1[]=that` - php multiple pass params >`?param1=this,that` - comma delimited list param >`?param1=this|that` - pipe delimited list param > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/REST/Plugin/Objects.t | 47 +++++++++++++++++++---- > 1 file changed, 39 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Koha/REST/Plugin/Objects.t b/t/db_dependent/Koha/REST/Plugin/Objects.t >index 60c9f811921..f6d9af83a4b 100755 >--- a/t/db_dependent/Koha/REST/Plugin/Objects.t >+++ b/t/db_dependent/Koha/REST/Plugin/Objects.t >@@ -196,7 +196,7 @@ subtest 'objects.search helper' => sub { > > subtest 'objects.search helper, sorting on mapped column' => sub { > >- plan tests => 14; >+ plan tests => 35; > > $schema->storage->txn_begin; > >@@ -205,23 +205,54 @@ subtest 'objects.search helper, sorting on mapped column' => sub { > > $builder->build_object({ class => 'Koha::Cities', value => { city_name => 'A', city_country => 'Argentina' } }); > $builder->build_object({ class => 'Koha::Cities', value => { city_name => 'B', city_country => 'Argentina' } }); >+ $builder->build_object({ class => 'Koha::Cities', value => { city_name => 'C', city_country => 'Argentina' } }); >+ $builder->build_object({ class => 'Koha::Cities', value => { city_name => 'C', city_country => 'Belarus' } }); > > my $t = Test::Mojo->new; >- $t->get_ok('/cities?_order_by=%2Bname&_order_by=+country') >+ diag("CSV-param"); >+ $t->get_ok('/cities?_order_by=%2Bname,-country') > ->status_is(200) > ->json_has('/0') > ->json_has('/1') >- ->json_hasnt('/2') > ->json_is('/0/name' => 'A') >- ->json_is('/1/name' => 'B'); >- >+ ->json_is('/1/name' => 'B') >+ ->json_is('/2/name' => 'C') >+ ->json_is('/2/country' => 'Belarus') >+ ->json_is('/3/name' => 'C') >+ ->json_is('/3/country' => 'Argentina') >+ ->json_hasnt('/4'); >+ >+ diag("Multi-param: traditional"); >+ $t->get_ok('/cities?_order_by=%2Bname&_order_by=-country') >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_has('/1') >+ ->json_is('/0/name' => 'A') >+ ->json_is('/1/name' => 'B') >+ ->json_is('/2/name' => 'C') >+ ->json_is('/2/country' => 'Belarus') >+ ->json_is('/3/name' => 'C') >+ ->json_is('/3/country' => 'Argentina') >+ ->json_hasnt('/4'); >+ >+ diag("Pipe-param: Passes validation (treated as a 'single value array or one string), subsequently explodes"); >+ $t->get_ok('/cities?_order_by=%2Bname|-country') >+ ->status_is(500); >+ >+ diag("Multi-param: PHP Style, Passes validation as above, subsequntly explodes"); >+ $t->get_ok('/cities?_order_by[]=%2Bname&_order_by[]=-country') >+ ->status_is(500); >+ >+ diag("Single-param"); > $t->get_ok('/cities?_order_by=-name') > ->status_is(200) > ->json_has('/0') > ->json_has('/1') >- ->json_hasnt('/2') >- ->json_is('/0/name' => 'B') >- ->json_is('/1/name' => 'A'); >+ ->json_is('/0/name' => 'C') >+ ->json_is('/1/name' => 'C') >+ ->json_is('/2/name' => 'B') >+ ->json_is('/3/name' => 'A') >+ ->json_hasnt('/4'); > > $schema->storage->txn_rollback; > }; >-- >2.30.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 27680
:
116794
|
116795
|
116796
|
116829
|
116831
|
116832
|
116833
|
116834
|
116843
|
116844
|
116845
|
116846
|
117335
|
117336
|
117337
|
117338
|
117339
|
117340
|
117341
|
117375
|
117388
|
117389
|
117390
|
117391
|
117392
|
117393
|
117394
|
117438
|
117439
|
117440
|
117441
|
117442
|
117476