diff mod_lib_ldap/dev/t/00-login.t @ 809:1d51c5e38faa

Add LDAP plugin suite
author rob@hoelz.ro
date Sun, 02 Sep 2012 15:35:50 +0200
parents
children 8495dae58d78
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_lib_ldap/dev/t/00-login.t	Sun Sep 02 15:35:50 2012 +0200
@@ -0,0 +1,49 @@
+use strict;
+use warnings;
+use lib 't';
+
+use TestConnection;
+use Test::More;
+
+my @users = (
+    'one',
+    'two',
+    'three',
+    'four',
+    'five',
+);
+
+plan tests => scalar(@users) + 2;
+
+foreach my $username (@users) {
+    my $conn = TestConnection->new($username);
+
+    $conn->reg_cb(session_ready => sub {
+        $conn->cond->send;
+    });
+
+    my $error = $conn->cond->recv;
+    ok(! $error) or diag($error);
+}
+
+do {
+    my $conn = TestConnection->new('one', password => '23451');
+
+    $conn->reg_cb(session_ready => sub {
+        $conn->cond->send;
+    });
+
+    my $error = $conn->cond->recv;
+    ok($error);
+};
+
+do {
+    my $conn = TestConnection->new('six', password => '12345');
+
+    $conn->reg_cb(session_ready => sub {
+        $conn->cond->send;
+    });
+
+    my $error = $conn->cond->recv;
+    ok($error);
+};