Bugzilla – Attachment 174965 Details for
Bug 36822
When creating a new patron via LDAP or Shibboleth 0000-00-00 is inserted for invalid updated_on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36822: Improve datetime comparison in tests
Bug-36822-Improve-datetime-comparison-in-tests.patch (text/plain), 2.79 KB, created by
Jonathan Druart
on 2024-11-25 10:58:08 UTC
(
hide
)
Description:
Bug 36822: Improve datetime comparison in tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-11-25 10:58:08 UTC
Size:
2.79 KB
patch
obsolete
>From 5450ff335de6dfb90e6d992e7f450be35f38a09c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 25 Nov 2024 11:57:54 +0100 >Subject: [PATCH] Bug 36822: Improve datetime comparison in tests > >--- > t/db_dependent/Auth_with_ldap.t | 7 ++++--- > t/db_dependent/Auth_with_shibboleth.t | 14 +++++++------- > 2 files changed, 11 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/Auth_with_ldap.t b/t/db_dependent/Auth_with_ldap.t >index 38f4dbca161..6c35aa5e5fa 100755 >--- a/t/db_dependent/Auth_with_ldap.t >+++ b/t/db_dependent/Auth_with_ldap.t >@@ -20,9 +20,11 @@ use Modern::Perl; > use Test::More tests => 4; > use Test::MockModule; > use Test::MockObject; >+use Test::Warn; >+ > use t::lib::Mocks; > use t::lib::TestBuilder; >-use Test::Warn; >+use t::lib::Dates; > > use C4::Context; > use C4::Auth; >@@ -276,11 +278,10 @@ 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, $time_now, >+ t::lib::Dates::compare( $patron_replicated_from_auth->updated_on, dt_from_string ), 0, > "updated_on correctly saved on newly created user" > ); > >diff --git a/t/db_dependent/Auth_with_shibboleth.t b/t/db_dependent/Auth_with_shibboleth.t >index 18b27124b36..d7f498ed39b 100755 >--- a/t/db_dependent/Auth_with_shibboleth.t >+++ b/t/db_dependent/Auth_with_shibboleth.t >@@ -29,6 +29,7 @@ use File::Temp qw(tempdir); > use t::lib::Mocks; > use t::lib::Mocks::Logger; > use t::lib::TestBuilder; >+use t::lib::Dates; > > use C4::Auth_with_shibboleth qw( shib_ok login_shib_url get_login_shib checkpw_shib ); > use Koha::Database; >@@ -309,15 +310,14 @@ 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"; >+ ok( >+ my $new_user_autocreated = Koha::Patrons->find( { userid => 'test43210' } ), >+ "new user found" >+ ); > >- my $rec_autocreated = $new_user_autocreated->next; >- is_deeply( >- [ map { $rec_autocreated->$_ } qw/updated_on/ ], >- [$time_now], >+ is( >+ t::lib::Dates::compare( $new_user_autocreated->updated_on, dt_from_string ), 0, > 'updated_on correctly saved on newly created user' > ); > }; >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36822
:
173373
|
173374
|
173375
|
173376
|
173377
|
173385
|
173386
|
173387
|
173388
|
173389
|
173391
|
173392
|
173393
|
173394
|
173395
|
173402
|
173403
|
173404
|
173405
|
173406
|
173646
|
173903
|
173904
|
173905
|
173906
|
173907
|
173908
|
173909
|
174523
|
174525
|
174926
|
174927
| 174965