Auth.t - running this test will fail unless Auth.pm patches get trough.
authorJoe Atzberger <joe.atzberger@liblime.com>
Sun, 2 Dec 2007 19:41:46 +0000 (13:41 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 4 Dec 2007 23:28:23 +0000 (17:28 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
t/Auth.t

index 9b1c640..1cacb31 100755 (executable)
--- a/t/Auth.t
+++ b/t/Auth.t
@@ -6,9 +6,36 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 6;
 
 BEGIN {
-        use_ok('C4::Auth');
+        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__