Bugzilla – Attachment 122292 Details for
Bug 28604
Bad encoding when using marc-in-json
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28604: Regression tests
Bug-28604-Regression-tests.patch (text/plain), 3.13 KB, created by
Martin Renvoize (ashimema)
on 2021-06-22 15:34:22 UTC
(
hide
)
Description:
Bug 28604: Regression tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-06-22 15:34:22 UTC
Size:
3.13 KB
patch
obsolete
>From cdd8923f48c9f84dde3c314e5cee08234393bcaf Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 18 Jun 2021 18:30:56 -0300 >Subject: [PATCH] Bug 28604: Regression tests > >This patch introduces regression tests for the encoding issue with MiJ >output. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/api/v1/biblios.t | 51 +++++++++++++++++++++++++++++++-- > 1 file changed, 49 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t >index 006d8f2da3..25665ed5cf 100755 >--- a/t/db_dependent/api/v1/biblios.t >+++ b/t/db_dependent/api/v1/biblios.t >@@ -17,6 +17,9 @@ > > use Modern::Perl; > >+use utf8; >+use Encode; >+ > use Test::More tests => 5; > use Test::MockModule; > use Test::Mojo; >@@ -38,7 +41,7 @@ my $t = Test::Mojo->new('Koha::REST::V1'); > > subtest 'get() tests' => sub { > >- plan tests => 21; >+ plan tests => 22; > > $schema->storage->txn_begin; > >@@ -100,6 +103,28 @@ 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; > }; > >@@ -194,7 +219,7 @@ subtest 'delete() tests' => sub { > > subtest 'get_public() tests' => sub { > >- plan tests => 25; >+ plan tests => 26; > > $schema->storage->txn_begin; > >@@ -277,6 +302,28 @@ 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 ) { >-- >2.20.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 28604
:
122188
|
122189
|
122190
|
122191
| 122292 |
122293