use Koha::Patrons;
-my $dbh = '';
-
# Start transaction
my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin();
my $patron = Koha::Patrons->find($borrower->{borrowernumber});
# C4::Auth_with_ldap needs several stuff set first ^^^
-use_ok('C4::Auth_with_ldap');
+use_ok('C4::Auth_with_ldap', qw( checkpw_ldap ));
can_ok(
'C4::Auth_with_ldap', qw/
checkpw_ldap
plan tests => 4;
- my $dbh = C4::Context->dbh;
## Connection fail tests
$desired_connection_result = 'error';
warning_is {
$ret =
- C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' );
+ C4::Auth_with_ldap::checkpw_ldap( 'hola', password => 'hey' );
}
'LDAP connexion failed',
'checkpw_ldap prints correct warning if LDAP conexion fails';
reload_ldap_module();
warning_like {
- $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola',
+ $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola',
password => 'hey' );
}
qr/Anonymous LDAP bind failed: LDAP error #1: error_name/,
reload_ldap_module();
warning_like {
- $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola',
+ $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola',
password => 'hey' );
}
qr/LDAP bind failed as kohauser hola: LDAP error #1: error_name/,
}
);
- C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' );
+ C4::Auth_with_ldap::checkpw_ldap( 'hola', password => 'hey' );
ok(
Koha::Patrons->find($borrower->{borrowernumber})->extended_attributes->count,
'Extended attributes are not deleted'
$patron->delete;
reload_ldap_module();
is(
- C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' ),
+ C4::Auth_with_ldap::checkpw_ldap( 'hola', password => 'hey' ),
0,
'checkpw_ldap returns 0 if user lookup returns 0'
);
reload_ldap_module();
warning_like {
- $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola',
+ $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola',
password => 'hey' );
}
qr/LDAP bind failed as kohauser hola: LDAP error #1: error_name/,
reload_ldap_module();
warning_like {
- $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola',
+ $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola',
password => 'hey' );
}
qr/LDAP bind failed as kohauser hola: LDAP error #1: error_name/,
reload_ldap_module();
warning_like {
- $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola',
+ $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola',
password => 'hey' );
}
qr/LDAP bind failed as ldapuser cn=Manager,dc=metavore,dc=com: LDAP error #1: error_name/,
reload_ldap_module();
warning_like {
- $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola',
+ $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola',
password => 'hey' );
}
qr/LDAP Auth rejected : invalid password for user 'hola'./,
reload_ldap_module();
warning_like {
- $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola',
+ $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola',
password => 'hey' );
}
qr/LDAP bind failed as ldapuser cn=Manager,dc=metavore,dc=com: LDAP error #1: error_name/,
reload_ldap_module();
warning_like {
- $ret = C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola',
+ $ret = C4::Auth_with_ldap::checkpw_ldap( 'hola',
password => 'hey' );
}
qr/LDAP Auth rejected : invalid password for user 'hola'./,
if ( ref $class eq 'HASH' ) {
return $class->{$param};
}
- return;
+
+ return C4::Context::_common_config($param, 'config');
}
# Function that mocks the call to Net::LDAP