-
Notifications
You must be signed in to change notification settings - Fork 54
/
Auth.t
executable file
·44 lines (38 loc) · 1.02 KB
/
Auth.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 6;
BEGIN {
use FindBin;
use lib $FindBin::Bin;
use override_context_prefs;
use_ok('C4::Auth', qw(checkpw));
use_ok('C4::Context');
}
use vars qw($dbh $ldap);
can_ok('C4::Context', 'config');
can_ok('C4::Context', 'dbh');
can_ok('C4::Auth', qw(checkpw));
ok($dbh = C4::Context->dbh(), "Getting dbh from C4::Context");
$ldap = C4::Context->config('useldapserver') || 0;
diag("Using LDAP? $ldap");
while (1) { # forever!
print "Do you want to test further accounts? (If not, just hit return.)\n";
my ($user, $pass);
print "Enter username: ";
chomp($user = <>);
($user) or exit;
print "Enter password: ";
chomp($pass = <>);
my ($retval,$retcard) = checkpw($dbh,$user,$pass);
$retval ||= '';
$retcard ||= '';
diag ("checkpw(\$dbh,$user,$pass) " . ($retval ? 'SUCCEEDS' : ' FAILS ') . "\treturns ($retval,$retcard)");
}
END {
diag("C4::Auth - end of test");
}
__END__