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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 5d92267018)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 832f488744)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit f7e574b98d)
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit f7e574b98d)
This commit is contained in:
parent
ad8e8c2a3b
commit
3de01174f3
|
|
@ -23,6 +23,7 @@ use Test::Warn;
|
|||
|
||||
use t::lib::TestBuilder;
|
||||
use t::lib::Mocks;
|
||||
use t::lib::Dates;
|
||||
|
||||
use C4::Auth;
|
||||
use Koha::Database;
|
||||
|
|
@ -325,7 +326,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…
Reference in New Issue