From 42e29ca6136b622dd02400cdbd05f4e595a404b0 Mon Sep 17 00:00:00 2001 From: Wainui Witika-Park Date: Mon, 20 Sep 2021 08:27:24 +0000 Subject: [PATCH 1/2] Revert "Bug 28604: Regression tests" This reverts commit c1a76b0d80b2d16bfb9160003cefe9f82557e832. --- t/db_dependent/api/v1/biblios.t | 51 ++------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t index 10474564b0..a4778cc8e3 100644 --- a/t/db_dependent/api/v1/biblios.t +++ b/t/db_dependent/api/v1/biblios.t @@ -17,9 +17,6 @@ use Modern::Perl; -use utf8; -use Encode; - use Test::More tests => 3; use Test::MockModule; use Test::Mojo; @@ -41,7 +38,7 @@ my $t = Test::Mojo->new('Koha::REST::V1'); subtest 'get() tests' => sub { - plan tests => 22; + plan tests => 21; $schema->storage->txn_begin; @@ -103,28 +100,6 @@ subtest 'get() tests' => sub { ->status_is(404) ->json_is( '/error', 'Object not found.' ); - subtest 'marc-in-json encoding tests' => sub { - - plan tests => 3; - - my $title_with_diacritics = "L'insoutenable légèreté de l'être"; - - my $biblio = $builder->build_sample_biblio( - { - title => $title_with_diacritics, - author => "Milan Kundera" - } - ); - - my $result = $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber - => { Accept => 'application/marc-in-json' } ) - ->status_is(200)->tx->res->body; - - my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); - - like( $result, qr/\Q$encoded_title/, "The title is not double encoded" ); - }; - $schema->storage->txn_rollback; }; @@ -182,7 +157,7 @@ subtest 'delete() tests' => sub { subtest 'get_public() tests' => sub { - plan tests => 26; + plan tests => 25; $schema->storage->txn_begin; @@ -265,28 +240,6 @@ subtest 'get_public() tests' => sub { ->content_is($biblio->metadata->record->as_formatted); }; - subtest 'marc-in-json encoding tests' => sub { - - plan tests => 3; - - my $title_with_diacritics = "L'insoutenable légèreté de l'être"; - - my $biblio = $builder->build_sample_biblio( - { - title => $title_with_diacritics, - author => "Milan Kundera" - } - ); - - my $result = $t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber - => { Accept => 'application/marc-in-json' } ) - ->status_is(200)->tx->res->body; - - my $encoded_title = Encode::encode( "UTF-8", $title_with_diacritics ); - - like( $result, qr/\Q$encoded_title/, "The title is not double encoded" ); - }; - # Hide author in OPAC $subfields = Koha::MarcSubfieldStructures->search({ tagfield => '100' }); while ( my $subfield = $subfields->next ) { From 2c402eabbf12aa07a3c3418b868ac7c1a8ee20e3 Mon Sep 17 00:00:00 2001 From: Wainui Witika-Park Date: Mon, 20 Sep 2021 08:27:48 +0000 Subject: [PATCH 2/2] Revert "Bug 28604: Prevent double encoding of MARC::Record::MiJ->to_mij output" This reverts commit 5c89018abd5b209ae48ec853bad599f0d670c328. --- Koha/REST/V1/Biblios.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index 0dac9b4a7b..cee90e3be0 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -75,7 +75,7 @@ sub get { mij => { status => 200, format => 'mij', - data => $record->to_mij + text => $record->to_mij }, marc => { status => 200, @@ -220,7 +220,7 @@ sub get_public { mij => { status => 200, format => 'mij', - data => $record->to_mij + text => $record->to_mij }, marc => { status => 200,