Bug 36822: (QA follow-up): Fix now time in tests
This is to prevent the scenario of tests failing if they take long to run, e.g.:
# Failed test 'updated_on correctly saved on newly created user'
# at t/db_dependent/Auth_with_shibboleth.t line 317.
# Structures begin differing at:
# ->[0] = '2024-11-04 11:20:13'
# ->[0] = '2024-11-04 11:20:14
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f945b29ca1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
4c15fb996d
commit
5ea41dd507
|
|
@ -276,10 +276,11 @@ subtest 'checkpw_ldap tests' => sub {
|
|||
$welcome = 0;
|
||||
|
||||
# replicate testing with checkpw
|
||||
my $time_now = dt_from_string()->ymd . ' ' . dt_from_string()->hms;
|
||||
C4::Auth::checkpw( 'hola', password => 'hey' );
|
||||
my $patron_replicated_from_auth = Koha::Patrons->search( { userid => 'hola' } )->next;
|
||||
is(
|
||||
$patron_replicated_from_auth->updated_on, dt_from_string()->ymd . ' ' . dt_from_string()->hms,
|
||||
$patron_replicated_from_auth->updated_on, $time_now,
|
||||
"updated_on correctly saved on newly created user"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -288,6 +288,7 @@ subtest "checkpw_shib tests" => sub {
|
|||
$ENV{'emailpro'} = 'me@myemail.com';
|
||||
$ENV{branchcode} = $library->branchcode; # needed since T::D::C does no longer hides the FK constraint
|
||||
|
||||
my $time_now = dt_from_string()->ymd . ' ' . dt_from_string()->hms;
|
||||
checkpw($shib_login);
|
||||
ok my $new_user_autocreated = $schema->resultset('Borrower')->search( { 'userid' => 'test43210' }, { rows => 1 } ),
|
||||
"new user found";
|
||||
|
|
@ -295,7 +296,7 @@ subtest "checkpw_shib tests" => sub {
|
|||
my $rec_autocreated = $new_user_autocreated->next;
|
||||
is_deeply(
|
||||
[ map { $rec_autocreated->$_ } qw/updated_on/ ],
|
||||
[ dt_from_string()->ymd . ' ' . dt_from_string()->hms ],
|
||||
[$time_now],
|
||||
'updated_on correctly saved on newly created user'
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue