Bug 36822: LDAP - Add test

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2024-10-25 14:41:38 +00:00 committed by Katrin Fischer
parent e3d071ac54
commit e567f78e27
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 17 additions and 1 deletions

View File

@ -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;
}