From 2eaf7b8fc3f339379ff9b5386a123c60d466a73c Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 27 Nov 2017 11:37:18 -0300 Subject: [PATCH] Bug 19370: (QA followup) Use OpenAPI's handling of pipe separated values This patch makes the helper handling _order_by params expect a list of values instead of a (to-be-splitted) string. The idea is that the OpenAPI plugin will take care of splitting pipe-delimited values if the spec is correctly defined. Note: In the process I noticed + on the URL represents a space, so the helper function is updated to handle both + and %2B as ascending. To test: - Run: $ kshell k$ prove t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! - Sign off :-D Edit: Removed rebasing leftover making the tests fail. Signed-off-by: Tomas Cohen Arazi --- t/Koha/REST/Plugin/Query.t | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t index ac126a17ae..7a853d4bff 100644 --- a/t/Koha/REST/Plugin/Query.t +++ b/t/Koha/REST/Plugin/Query.t @@ -128,40 +128,3 @@ subtest 'dbic_merge_sorting() tests' => sub { ] ); }; - -subtest '_build_query_params_from_api' => sub { - - plan tests => 16; - - my $t = Test::Mojo->new; - - # _match => contains - $t->get_ok('/build_query?_match=contains&title=Ender&author=Orson') - ->status_is(200) - ->json_is( '/query' => - { author => { like => '%Orson%' }, title => { like => '%Ender%' } } ); - - # _match => starts_with - $t->get_ok('/build_query?_match=starts_with&title=Ender&author=Orson') - ->status_is(200) - ->json_is( '/query' => - { author => { like => 'Orson%' }, title => { like => 'Ender%' } } ); - - # _match => ends_with - $t->get_ok('/build_query?_match=ends_with&title=Ender&author=Orson') - ->status_is(200) - ->json_is( '/query' => - { author => { like => '%Orson' }, title => { like => '%Ender' } } ); - - # _match => exact - $t->get_ok('/build_query?_match=exact&title=Ender&author=Orson') - ->status_is(200) - ->json_is( '/query' => { author => 'Orson', title => 'Ender' } ); - - # _match => blah - $t->get_ok('/build_query?_match=blah&title=Ender&author=Orson') - ->status_is(400) - ->json_is( '/exception_msg' => 'Invalid value for _match param (blah)' ) - ->json_is( '/exception_type' => 'Koha::Exceptions::WrongParameter' ); - -}; -- 2.14.1