annotate mod_lib_ldap/dev/t/00-login.t @ 867:a93cb608db2c

Print the username if a test login fails
author Rob Hoelz <rob@hoelz.ro>
date Mon, 10 Dec 2012 22:05:24 +0100
parents 8495dae58d78
children a8e777e2d44f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
809
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
1 use strict;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
2 use warnings;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
3 use lib 't';
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
4
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
5 use TestConnection;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
6 use Test::More;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
7
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
8 my @users = (
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
9 'one',
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
10 'two',
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
11 'three',
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
12 'four',
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
13 'five',
866
8495dae58d78 Test login for user 'six'
Rob Hoelz <rob@hoelz.ro>
parents: 809
diff changeset
14 'six',
809
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
15 );
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
16
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
17 plan tests => scalar(@users) + 2;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
18
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
19 foreach my $username (@users) {
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
20 my $conn = TestConnection->new($username);
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
21
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
22 $conn->reg_cb(session_ready => sub {
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
23 $conn->cond->send;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
24 });
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
25
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
26 my $error = $conn->cond->recv;
867
a93cb608db2c Print the username if a test login fails
Rob Hoelz <rob@hoelz.ro>
parents: 866
diff changeset
27 ok(! $error) or diag("$username login failed: $error");
809
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
28 }
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
29
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
30 do {
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
31 my $conn = TestConnection->new('one', password => '23451');
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
32
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
33 $conn->reg_cb(session_ready => sub {
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
34 $conn->cond->send;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
35 });
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
36
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
37 my $error = $conn->cond->recv;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
38 ok($error);
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
39 };
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
40
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
41 do {
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
42 my $conn = TestConnection->new('six', password => '12345');
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
43
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
44 $conn->reg_cb(session_ready => sub {
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
45 $conn->cond->send;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
46 });
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
47
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
48 my $error = $conn->cond->recv;
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
49 ok($error);
1d51c5e38faa Add LDAP plugin suite
rob@hoelz.ro
parents:
diff changeset
50 };