adding a new option, -w, which disables shadow indexing for the current batch (faster...
[koha.git] / t / 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_ok('C4::Auth', qw(checkpw));
13         use_ok('C4::Context');
14 }
15
16 use vars qw($dbh $ldap);
17 can_ok('C4::Context', 'config');
18 can_ok('C4::Context', 'dbh');
19 can_ok('C4::Auth', qw(checkpw));
20     ok($dbh  = C4::Context->dbh(),  "Getting dbh from C4::Context");
21 $ldap = C4::Context->config('useldapserver') || 0;
22 diag("Using LDAP? $ldap");
23
24 while (1) {             # forever!
25         print "Do you want to test further accounts? (If not, just hit return.)\n";
26         my ($user, $pass);
27         print "Enter username: ";
28         chomp($user = <>);
29         ($user) or exit;
30         print "Enter password: ";
31         chomp($pass = <>);
32         my ($retval,$retcard) = checkpw($dbh,$user,$pass);
33         $retval  ||= '';
34         $retcard ||= '';
35         diag ("checkpw(\$dbh,$user,$pass) " . ($retval ? 'SUCCEEDS' : ' FAILS  ') . "\treturns ($retval,$retcard)");
36 }
37
38 END {
39         diag("C4::Auth - end of test");
40 }
41 __END__