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