From b1925c6a1b4f40db325bfb2fbed09833ec6019ab 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 --- t/db_dependent/Auth_with_ldap.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Auth_with_ldap.t b/t/db_dependent/Auth_with_ldap.t index 2b6727100d..3e24c22e69 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,14 @@ 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, "The notice was sent immediately" ); + + $patron_replicated_from_auth->delete; + $auth->unmock('ldap_entry_2_hash'); # end replicate testing @@ -499,6 +509,9 @@ sub mockedC4Config { my $class = shift; my $param = shift; + if ( $param eq 'useldapserver' ) { + return 1; + } if ( $param eq 'useshibboleth' ) { return 0; } -- 2.39.5