Bugzilla – Attachment 123382 Details for
Bug 28741
OAI ListSets does not correctly build resumption token
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28741: Regression tests
Bug-28741-Regression-tests.patch (text/plain), 3.05 KB, created by
Tomás Cohen Arazi
on 2021-08-02 13:19:35 UTC
(
hide
)
Description:
Bug 28741: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2021-08-02 13:19:35 UTC
Size:
3.05 KB
patch
obsolete
>From 5d3225caf0721b439da259332df3deaf25d0ff50 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 30 Jul 2021 14:53:31 -0300 >Subject: [PATCH] Bug 28741: Regression tests > >This patch adds regression tests for the behavior. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/OAI/Server.t | 82 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 81 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t >index 48fea418eb..4c3e641583 100755 >--- a/t/db_dependent/OAI/Server.t >+++ b/t/db_dependent/OAI/Server.t >@@ -21,7 +21,7 @@ use Modern::Perl; > use Test::Deep qw( cmp_deeply re ); > use Test::MockTime qw/set_fixed_time restore_time/; > >-use Test::More tests => 31; >+use Test::More tests => 32; > use DateTime; > use File::Basename; > use File::Spec; >@@ -34,6 +34,7 @@ use t::lib::Mocks; > > use C4::Biblio qw( AddBiblio GetMarcBiblio ModBiblio ); > use C4::Context; >+use C4::OAI::Sets qw(AddOAISet); > > use Koha::Biblio::Metadatas; > use Koha::Database; >@@ -430,3 +431,82 @@ subtest 'Bug 20665: OAI-PMH Provider should reset the MySQL connection time zone > > > $schema->storage->txn_rollback; >+ >+subtest 'ListSets tests' => sub { >+ >+ plan tests => 3; >+ >+ t::lib::Mocks::mock_preference( 'OAI::PMH' => 1 ); >+ t::lib::Mocks::mock_preference( 'OAI-PMH:MaxCount' => 3 ); >+ >+ $schema->storage->txn_begin; >+ >+ $dbh->do('DELETE FROM oai_sets'); >+ >+ # Add a bunch of sets >+ my @first_page_sets = (); >+ for my $i ( 1 .. 3 ) { >+ >+ AddOAISet( >+ { 'spec' => "setSpec_$i", >+ 'name' => "setName_$i", >+ } >+ ); >+ push @first_page_sets, { setSpec => "setSpec_$i", setName => "setName_$i" }; >+ } >+ >+ # Add more to force pagination >+ my @second_page_sets = (); >+ for my $i ( 4 .. 6 ) { >+ >+ AddOAISet( >+ { 'spec' => "setSpec_$i", >+ 'name' => "setName_$i", >+ } >+ ); >+ push @second_page_sets, { setSpec => "setSpec_$i", setName => "setName_$i" }; >+ } >+ >+ AddOAISet( >+ { 'spec' => "setSpec_7", >+ 'name' => "setName_7", >+ } >+ ); >+ >+ test_query( >+ 'ListSets', >+ { verb => 'ListSets' }, >+ { ListSets => { >+ resumptionToken => { >+ content => re( qr{^/3////1/0/4$} ), >+ cursor => 3, >+ }, >+ set => \@first_page_sets >+ } >+ } >+ ); >+ >+ test_query( >+ 'ListSets', >+ { verb => 'ListSets', resumptionToken => '/3////1/0/4' }, >+ { ListSets => { >+ resumptionToken => { >+ content => re( qr{^/6////1/0/7$} ), >+ cursor => 6, >+ }, >+ set => \@second_page_sets >+ } >+ } >+ ); >+ >+ test_query( >+ 'ListSets', >+ { verb => 'ListSets', resumptionToken => "/6////1/0/7" }, >+ { ListSets => { >+ set => { setSpec => "setSpec_7", setName => "setName_7" } >+ } >+ } >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.32.0
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 28741
:
123063
|
123066
|
123369
| 123382 |
123383
|
123384
|
124054