From d0509a6b035172bcc9001ccee4cce607f2cf5d9c Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 25 Oct 2024 14:41:38 +0000 Subject: [PATCH] Bug 36822: LDAP - Add test Signed-off-by: David Nind --- t/db_dependent/Auth_with_ldap.t | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Auth_with_ldap.t b/t/db_dependent/Auth_with_ldap.t index 2b6727100d..8f7e87f38b 100755 --- a/t/db_dependent/Auth_with_ldap.t +++ b/t/db_dependent/Auth_with_ldap.t @@ -25,8 +25,10 @@ use t::lib::TestBuilder; use Test::Warn; use C4::Context; +use C4::Auth; use Koha::Patrons; +use Koha::DateUtils qw( dt_from_string ); # Hide all the subrouteine redefined warnings when running this test.. # We reload the ldap module lots in the test and each reload triggers the @@ -155,7 +157,7 @@ subtest 'checkpw_ldap tests' => sub { subtest 'auth_by_bind = 1 tests' => sub { - plan tests => 14; + plan tests => 15; $auth_by_bind = 1; @@ -272,6 +274,17 @@ subtest 'checkpw_ldap tests' => sub { $patron->delete; $replicate = 0; $welcome = 0; + + # replicate testing with checkpw + 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, + "updated_on correctly saved on newly created user" + ); + + $patron_replicated_from_auth->delete; + $auth->unmock('ldap_entry_2_hash'); # end replicate testing @@ -499,6 +512,9 @@ sub mockedC4Config { my $class = shift; my $param = shift; + if ( $param eq 'useldapserver' ) { + return 1; + } if ( $param eq 'useshibboleth' ) { return 0; } -- 2.39.5