Bug 18794: Fix test ListMetadataFormats in OAI/Server.t

This test may fail on slow servers, it compares the response date with
'now', but both can differ a bit.

https://jenkins.koha-community.org/job/Koha_Master_D8/198/consoleFull

   Failed test 'ListMetadataFormats'
   at t/db_dependent/OAI/Server.t line 150.
     Structures begin differing at:
          $got->{responseDate} = '2017-06-12T14:31:51Z'
     $expected->{responseDate} = '2017-06-12T14:31:50Z'
This commit is contained in:
Jonathan Druart 2017-10-05 17:42:21 -03:00 committed by Katrin Fischer
parent 96fa3f51e1
commit b975b971b4
1 changed files with 2 additions and 4 deletions

View File

@ -82,10 +82,8 @@ my $get_response = sub {
$response = XMLin($stdout);
};
$get_response->();
my $now = DateTime->now . 'Z';
my $expected = {
request => 'http://localhost',
responseDate => $now,
xmlns => 'http://www.openarchives.org/OAI/2.0/',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => 'http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd',
@ -104,14 +102,13 @@ my $expected = {
],
},
};
delete $response->{responseDate};
is_deeply($response, $expected, "ListMetadataFormats");
%param = ( verb => 'ListIdentifiers' );
$get_response->();
$now = DateTime->now . 'Z';
$expected = {
request => 'http://localhost',
responseDate => $now,
xmlns => 'http://www.openarchives.org/OAI/2.0/',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation' => 'http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd',
@ -120,6 +117,7 @@ $expected = {
content => "Required argument 'metadataPrefix' was undefined",
},
};
delete $response->{responseDate};
is_deeply($response, $expected, "ListIdentifiers without metadaPrefix argument");
$dbh->rollback;