Bugzilla – Attachment 152429 Details for
Bug 33971
Remove support for x-koha-query header
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33971: Remove x-koha-query usage in biblios.t
Bug-33971-Remove-x-koha-query-usage-in-bibliost.patch (text/plain), 4.14 KB, created by
Jonathan Druart
on 2023-06-16 15:37:34 UTC
(
hide
)
Description:
Bug 33971: Remove x-koha-query usage in biblios.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-06-16 15:37:34 UTC
Size:
4.14 KB
patch
obsolete
>From 9fc9c063d6a10802a401846fe08b5effd8db625d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 13 Jun 2023 10:44:47 -0300 >Subject: [PATCH] Bug 33971: Remove x-koha-query usage in biblios.t > >This patch removes handling of x-koha-query from the tests. > >To test: >1. Run: > $ ktd --shell > k$ prove t/db_dependent/api/v1/biblios.t >=> SUCCESS: Tests pass >2. Apply this patch >3. Repeat 1 >=> SUCCESS: Tests still pass! Change from x-koha-header to q= gives same >results. >4. Sign off :-D > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/api/v1/biblios.t | 45 +++++++++++++-------------------- > 1 file changed, 18 insertions(+), 27 deletions(-) > >diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t >index eb6dcaa78b4..04379ddf11c 100755 >--- a/t/db_dependent/api/v1/biblios.t >+++ b/t/db_dependent/api/v1/biblios.t >@@ -28,6 +28,8 @@ use Test::Warn; > use t::lib::Mocks; > use t::lib::TestBuilder; > >+use Mojo::JSON qw(encode_json); >+ > use C4::Auth; > use C4::Circulation qw( AddIssue AddReturn ); > >@@ -1646,45 +1648,34 @@ subtest 'list() tests' => sub { > $record->leader(' nam 3 4500'); > $biblio->metadata->metadata($record->as_xml_record('UNIMARC'))->store; > >- my $biblionumber1 = $biblio->biblionumber; >+ my $biblio_id_1 = $biblio->id; > > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); >- my $biblionumber2 = $builder->build_sample_biblio->biblionumber; >+ my $biblio_id_2 = $builder->build_sample_biblio->id; > >- my $search = >-"[{\"biblionumber\": \"$biblionumber1\"}, {\"biblionumber\": \"$biblionumber2\"}]"; >- $t->get_ok( >- "//$userid:$password@/api/v1/biblios/" => { 'x-koha-query' => $search } >- )->status_is(403); >+ my $query = encode_json( [ { biblio_id => $biblio_id_1 }, { biblio_id => $biblio_id_2 } ] ); >+ >+ $t->get_ok("//$userid:$password@/api/v1/biblios?q=$query")->status_is(403); > > $patron->flags(4)->store; > >- $t->get_ok( "//$userid:$password@/api/v1/biblios/" => >- { Accept => 'application/weird+format', 'x-koha-query' => $search } ) >- ->status_is(400); >+ $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/weird+format' } ) >+ ->status_is(400); > >- $t->get_ok( "//$userid:$password@/api/v1/biblios/" => >- { Accept => 'application/json', 'x-koha-query' => $search } ) >- ->status_is(200); >+ $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/json' } )->status_is(200); > >- my $result = $t->get_ok( "//$userid:$password@/api/v1/biblios/" => >- { Accept => 'application/marcxml+xml', 'x-koha-query' => $search } ) >- ->status_is(200)->tx->res->body; >+ my $result = $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/marcxml+xml' } ) >+ ->status_is(200)->tx->res->body; > >- my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); >+ my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); > like( $result, qr/\Q$encoded_title/, "The title is not double encoded" ); > >- $t->get_ok( "//$userid:$password@/api/v1/biblios/" => >- { Accept => 'application/marc-in-json', 'x-koha-query' => $search } ) >- ->status_is(200); >+ $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/marc-in-json' } ) >+ ->status_is(200); > >- $t->get_ok( "//$userid:$password@/api/v1/biblios/" => >- { Accept => 'application/marc', 'x-koha-query' => $search } ) >- ->status_is(200); >+ $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'application/marc' } )->status_is(200); > >- $t->get_ok( "//$userid:$password@/api/v1/biblios/" => >- { Accept => 'text/plain', 'x-koha-query' => $search } ) >- ->status_is(200); >+ $t->get_ok( "//$userid:$password@/api/v1/biblios?q=$query" => { Accept => 'text/plain' } )->status_is(200); > > $schema->storage->txn_rollback; > }; >@@ -1801,4 +1792,4 @@ subtest 'update_item() tests' => sub { > ->json_is('/replacement_price', 30); > > $schema->storage->txn_rollback; >-}; >\ No newline at end of file >+}; >-- >2.25.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 33971
:
152302
|
152303
|
152304
|
152422
|
152429
|
152430
|
152431
|
152690
|
152691
|
152692