Browse Source

Bug 28632: Prevent api/v1/patrons.t to fail on dates comparison

#   Failed test 'Returned patron from update matches expected'
 #   at t/db_dependent/api/v1/patrons.t line 537.
 #     Structures begin differing at:
 #          $got->{updated_on} = '2021-07-27T13:33:53+00:00'
 #     $expected->{updated_on} = '2021-07-27T13:33:52+00:00'
 # Looks like you failed 1 test of 42.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
master
Jonathan Druart 2 months ago
parent
commit
103f9e8e5e
  1. 9
      t/db_dependent/api/v1/patrons.t

9
t/db_dependent/api/v1/patrons.t

@ -24,6 +24,7 @@ use Test::Warn;
use t::lib::TestBuilder;
use t::lib::Mocks;
use t::lib::Dates;
use C4::Auth;
use Koha::Database;
@ -534,7 +535,13 @@ subtest 'update() tests' => sub {
$newpatron->{patron_id} = $unauthorized_patron->to_api->{patron_id};
$newpatron->{restricted} = $unauthorized_patron->to_api->{restricted};
$newpatron->{anonymized} = $unauthorized_patron->to_api->{anonymized};
is_deeply($result->tx->res->json, $newpatron, 'Returned patron from update matches expected');
my $got = $result->tx->res->json;
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');
t::lib::Dates::compare( $updated_on_got, $updated_on_expected, 'updated_on values matched' );
is(Koha::Patrons->find( $patron_2->id )->cardnumber,
$newpatron->{ cardnumber }, 'Patron is really updated!');

Loading…
Cancel
Save