Bug 29403: Fix api/v1/patrons.t
t::lib::Dates::compare expects either correct DateTime objects, or a system formatted datetime strings to be passed.. but as we're testing the API, we are consistently using RFC3339 strings for date-times and ISO8601 strings for dates. We need to therefore pre-process the strings into DateTime objects for the comparison. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
9b3a443477
commit
df34a4d53f
|
|
@ -659,7 +659,14 @@ subtest 'update() tests' => sub {
|
|||
my $updated_on_got = delete $got->{updated_on};
|
||||
my $updated_on_expected = delete $newpatron->{updated_on};
|
||||
is_deeply($got, $newpatron, 'Returned patron from update matches expected');
|
||||
is( t::lib::Dates::compare( $updated_on_got, $updated_on_expected ), 0, 'updated_on values matched' );
|
||||
is(
|
||||
t::lib::Dates::compare(
|
||||
dt_from_string( $updated_on_got, 'rfc3339' ),
|
||||
dt_from_string( $updated_on_expected, 'rfc3339' )
|
||||
),
|
||||
0,
|
||||
'updated_on values matched'
|
||||
);
|
||||
|
||||
is(Koha::Patrons->find( $patron_2->id )->cardnumber,
|
||||
$newpatron->{ cardnumber }, 'Patron is really updated!');
|
||||
|
|
|
|||
Loading…
Reference in New Issue