Bugzilla – Attachment 148614 Details for
Bug 32336
MARCXML output of REST API may be badly encoded (UNIMARC)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32336: Add unit test for UNIMARC encoding problems in REST API
Bug-32336-Add-unit-test-for-UNIMARC-encoding-probl.patch (text/plain), 2.12 KB, created by
Jonathan Druart
on 2023-03-23 14:28:22 UTC
(
hide
)
Description:
Bug 32336: Add unit test for UNIMARC encoding problems in REST API
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-03-23 14:28:22 UTC
Size:
2.12 KB
patch
obsolete
>From 055658237550f43df84d50496bb03be6cc54fc94 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 20 Jan 2023 15:33:39 +0100 >Subject: [PATCH] Bug 32336: Add unit test for UNIMARC encoding problems in > REST API > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/api/v1/biblios.t | 33 ++++++++++++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t >index afff055e360..d0740842388 100755 >--- a/t/db_dependent/api/v1/biblios.t >+++ b/t/db_dependent/api/v1/biblios.t >@@ -45,7 +45,7 @@ my $t = Test::Mojo->new('Koha::REST::V1'); > > subtest 'get() tests' => sub { > >- plan tests => 21; >+ plan tests => 22; > > $schema->storage->txn_begin; > >@@ -124,6 +124,37 @@ subtest 'get() tests' => sub { > like( $result, qr/\Q$encoded_title/, "The title is not double encoded" ); > }; > >+ subtest 'marcxml encoding tests' => sub { >+ plan tests => 3; >+ >+ my $marcflavour = C4::Context->preference('marcflavour'); >+ t::lib::Mocks::mock_preference('marcflavour', 'UNIMARC'); >+ >+ >+ 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 $record = $biblio->metadata->record; >+ $record->leader(' nam 3 4500'); >+ $biblio->metadata->metadata($record->as_xml_record('UNIMARC')); >+ $biblio->metadata->store; >+ >+ my $result = $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber >+ => { Accept => 'application/marcxml+xml' } ) >+ ->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" ); >+ t::lib::Mocks::mock_preference('marcflavour', $marcflavour); >+ }; >+ > $schema->storage->txn_rollback; > }; > >-- >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 32336
:
144207
|
146846
|
146847
| 148614 |
148615
|
148628