Bugzilla – Attachment 58060 Details for
Bug 15108
OAI-PMH provider improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15108: Fix OAI Server tests
Bug-15108-Fix-OAI-Server-tests.patch (text/plain), 10.64 KB, created by
Marcel de Rooy
on 2016-12-09 10:15:26 UTC
(
hide
)
Description:
Bug 15108: Fix OAI Server tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-12-09 10:15:26 UTC
Size:
10.64 KB
patch
obsolete
>From 7a7459d22c57121bcf92f21913f442eb169e4128 Mon Sep 17 00:00:00 2001 >From: =?utf-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Mon, 24 Oct 2016 15:17:50 +0000 >Subject: [PATCH] Bug 15108: Fix OAI Server tests >Content-Type: text/plain; charset=utf-8 > >Tests introduced by bug 17493 must be amended to accomodate the new >resumption tokens (with time) returned by OAI Server. >--- > Koha/OAI/Server/ResumptionToken.pm | 4 +-- > t/db_dependent/OAI/Server.t | 59 ++++++++++++++++++++++---------------- > 2 files changed, 37 insertions(+), 26 deletions(-) > >diff --git a/Koha/OAI/Server/ResumptionToken.pm b/Koha/OAI/Server/ResumptionToken.pm >index 5fbf9cb..7062573 100644 >--- a/Koha/OAI/Server/ResumptionToken.pm >+++ b/Koha/OAI/Server/ResumptionToken.pm >@@ -41,7 +41,8 @@ sub new { > > my $self = $class->SUPER::new(%args); > >- my ($metadata_prefix, $offset, $from, $until, $set, $deleted); >+ my ($metadata_prefix, $offset, $from, $until, $set); >+ my $deleted = defined $args{ deleted } ? $args{ deleted } : 1; > if ( $args{ resumptionToken } ) { > ($metadata_prefix, $offset, $from, $until, $set, $deleted) > = split( '/', $args{resumptionToken} ); >@@ -59,7 +60,6 @@ sub new { > $until .= 'T23:59:59Z' if length($until) == 10; > $offset = $args{ offset } || 0; > $set = $args{ set } || ''; >- $deleted = defined $args{ deleted } ? $args{ deleted } : 1; > } > > $self->{ metadata_prefix } = $metadata_prefix; >diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t >index bc35903..8a177c0 100644 >--- a/t/db_dependent/OAI/Server.t >+++ b/t/db_dependent/OAI/Server.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 27; >+use Test::More tests => 28; > use DateTime; > use Test::MockModule; > use Test::Warn; >@@ -37,6 +37,7 @@ BEGIN { > use_ok('Koha::OAI::Server::Description'); > use_ok('Koha::OAI::Server::GetRecord'); > use_ok('Koha::OAI::Server::Identify'); >+ use_ok('Koha::OAI::Server::ListBase'); > use_ok('Koha::OAI::Server::ListIdentifiers'); > use_ok('Koha::OAI::Server::ListMetadataFormats'); > use_ok('Koha::OAI::Server::ListRecords'); >@@ -56,23 +57,27 @@ $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; > > $dbh->do('SET FOREIGN_KEY_CHECKS = 0'); >+$dbh->do("SET time_zone='+00:00'"); > $dbh->do('TRUNCATE biblio'); > $dbh->do('TRUNCATE biblioitems'); > $dbh->do('TRUNCATE issues'); > >-our $tz = DateTime::TimeZone->new( name => 'local' ); >-my $date_added = DateTime->now(time_zone =>$tz) . 'Z'; >+my $date_added = DateTime->now() . 'Z'; > my $date_to = substr($date_added, 0, 10) . 'T23:59:59Z'; > my (@header, @marcxml, @oaidc); >+my $sth = $dbh->prepare('SELECT timestamp FROM biblioitems WHERE biblionumber=?'); > > # Add 10 biblio records > foreach( 1..10 ) { > my $record = MARC::Record->new(); > $record->append_fields( MARC::Field->new('245', '', '', 'a' => "Title $_" ) ); > my ($biblionumber) = AddBiblio($record, ''); >+ $sth->execute($biblionumber); >+ my $timestamp = $sth->fetchrow_array . 'Z'; >+ $timestamp =~ s/ /T/; > $record = GetMarcBiblio($biblionumber); > $record = XMLin($record->as_xml_record); >- $header[$biblionumber] = { datestamp => $date_added, identifier => "TEST:$biblionumber" }; >+ $header[$biblionumber] = { datestamp => $timestamp, identifier => "TEST:$biblionumber" }; > delete $record->{$_} for (('xmlns','xmlns:xsi','xsi:schemaLocation')); > $oaidc[$biblionumber] = { > header => $header[$biblionumber], >@@ -107,6 +112,7 @@ foreach( 1..10 ) { > }, > }, > }; >+ sleep 2; # FIXME Why do we need this sleep? > } > > my $syspref = { >@@ -163,12 +169,17 @@ test_query('ListMetadataFormats', {verb => 'ListMetadataFormats'}, { > }, > { > metadataNamespace => 'http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim', >+ metadataPrefix => 'marc21', >+ schema => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd', >+ }, >+ { >+ metadataNamespace => 'http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim', > metadataPrefix => 'marcxml', > schema => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd', > }, > ], > }, >-} ); >+}); > > test_query('ListIdentifiers without metadataPrefix', {verb => 'ListIdentifiers'}, { > error => { >@@ -182,7 +193,7 @@ test_query('ListIdentifiers', {verb => 'ListIdentifiers', metadataPrefix => 'mar > ListIdentifiers => { > header => [ @header[1..3] ], > resumptionToken => { >- content => "marcxml/3/1970-01-01T00:00:00Z/$date_to/", >+ content => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0", > cursor => 3, > }, > }, >@@ -192,7 +203,7 @@ test_query('ListIdentifiers', {verb => 'ListIdentifiers', metadataPrefix => 'mar > ListIdentifiers => { > header => [ @header[1..3] ], > resumptionToken => { >- content => "marcxml/3/1970-01-01T00:00:00Z/$date_to/", >+ content => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0", > cursor => 3, > }, > }, >@@ -200,12 +211,12 @@ test_query('ListIdentifiers', {verb => 'ListIdentifiers', metadataPrefix => 'mar > > test_query( > 'ListIdentifiers with resumptionToken 1', >- { verb => 'ListIdentifiers', resumptionToken => "marcxml/3/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListIdentifiers', resumptionToken => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0" }, > { > ListIdentifiers => { > header => [ @header[4..6] ], > resumptionToken => { >- content => "marcxml/6/1970-01-01T00:00:00Z/$date_to/", >+ content => "marcxml/6/1970-01-01T00:00:00Z/$date_to//0", > cursor => 6, > }, > }, >@@ -215,12 +226,12 @@ test_query( > > test_query( > 'ListIdentifiers with resumptionToken 2', >- { verb => 'ListIdentifiers', resumptionToken => "marcxml/6/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListIdentifiers', resumptionToken => "marcxml/6/1970-01-01T00:00:00Z/$date_to//0" }, > { > ListIdentifiers => { > header => [ @header[7..9] ], > resumptionToken => { >- content => "marcxml/9/1970-01-01T00:00:00Z/$date_to/", >+ content => "marcxml/9/1970-01-01T00:00:00Z/$date_to//0", > cursor => 9, > }, > }, >@@ -230,7 +241,7 @@ test_query( > > test_query( > 'ListIdentifiers with resumptionToken 3, response without resumption', >- { verb => 'ListIdentifiers', resumptionToken => "marcxml/9/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListIdentifiers', resumptionToken => "marcxml/9/1970-01-01T00:00:00Z/$date_to//0" }, > { > ListIdentifiers => { > header => $header[10], >@@ -250,7 +261,7 @@ test_query('ListRecords marcxml', {verb => 'ListRecords', metadataPrefix => 'mar > ListRecords => { > record => [ @marcxml[1..3] ], > resumptionToken => { >- content => "marcxml/3/1970-01-01T00:00:00Z/$date_to/", >+ content => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0", > cursor => 3, > }, > }, >@@ -258,11 +269,11 @@ test_query('ListRecords marcxml', {verb => 'ListRecords', metadataPrefix => 'mar > > test_query( > 'ListRecords marcxml with resumptionToken 1', >- { verb => 'ListRecords', resumptionToken => "marcxml/3/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListRecords', resumptionToken => "marcxml/3/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { > record => [ @marcxml[4..6] ], > resumptionToken => { >- content => "marcxml/6/1970-01-01T00:00:00Z/$date_to/", >+ content => "marcxml/6/1970-01-01T00:00:00Z/$date_to//0", > cursor => 6, > }, > }, >@@ -270,11 +281,11 @@ test_query( > > test_query( > 'ListRecords marcxml with resumptionToken 2', >- { verb => 'ListRecords', resumptionToken => "marcxml/6/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListRecords', resumptionToken => "marcxml/6/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { > record => [ @marcxml[7..9] ], > resumptionToken => { >- content => "marcxml/9/1970-01-01T00:00:00Z/$date_to/", >+ content => "marcxml/9/1970-01-01T00:00:00Z/$date_to//0", > cursor => 9, > }, > }, >@@ -283,7 +294,7 @@ test_query( > # Last record, so no resumption token > test_query( > 'ListRecords marcxml with resumptionToken 3, response without resumption', >- { verb => 'ListRecords', resumptionToken => "marcxml/9/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListRecords', resumptionToken => "marcxml/9/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { > record => $marcxml[10], > }, >@@ -293,7 +304,7 @@ test_query('ListRecords oai_dc', {verb => 'ListRecords', metadataPrefix => 'oai_ > ListRecords => { > record => [ @oaidc[1..3] ], > resumptionToken => { >- content => "oai_dc/3/1970-01-01T00:00:00Z/$date_to/", >+ content => "oai_dc/3/1970-01-01T00:00:00Z/$date_to//0", > cursor => 3, > }, > }, >@@ -301,11 +312,11 @@ test_query('ListRecords oai_dc', {verb => 'ListRecords', metadataPrefix => 'oai_ > > test_query( > 'ListRecords oai_dc with resumptionToken 1', >- { verb => 'ListRecords', resumptionToken => "oai_dc/3/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListRecords', resumptionToken => "oai_dc/3/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { > record => [ @oaidc[4..6] ], > resumptionToken => { >- content => "oai_dc/6/1970-01-01T00:00:00Z/$date_to/", >+ content => "oai_dc/6/1970-01-01T00:00:00Z/$date_to//0", > cursor => 6, > }, > }, >@@ -313,11 +324,11 @@ test_query( > > test_query( > 'ListRecords oai_dc with resumptionToken 2', >- { verb => 'ListRecords', resumptionToken => "oai_dc/6/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListRecords', resumptionToken => "oai_dc/6/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { > record => [ @oaidc[7..9] ], > resumptionToken => { >- content => "oai_dc/9/1970-01-01T00:00:00Z/$date_to/", >+ content => "oai_dc/9/1970-01-01T00:00:00Z/$date_to//0", > cursor => 9, > }, > }, >@@ -326,7 +337,7 @@ test_query( > # Last record, so no resumption token > test_query( > 'ListRecords oai_dc with resumptionToken 3, response without resumption', >- { verb => 'ListRecords', resumptionToken => "oai_dc/9/1970-01-01T00:00:00Z/$date_to/" }, >+ { verb => 'ListRecords', resumptionToken => "oai_dc/9/1970-01-01T00:00:00Z/$date_to//0" }, > { ListRecords => { > record => $oaidc[10], > }, >-- >2.1.4
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 15108
:
44317
|
44318
|
51962
|
52416
|
52422
|
52423
|
53853
|
53854
|
56813
|
56844
|
58058
|
58059
|
58060
|
58061
|
58062
|
58063
|
58064
|
58065
|
58072
|
58080
|
58245
|
58246
|
58247
|
58248
|
58249
|
58250
|
58251
|
60260
|
60331
|
60608
|
60835
|
60836
|
63172
|
63173
|
63174