annotate mod_lib_ldap/dev/t/00-login.t @ 2338:51beecac93c2

mod_carbons: Fix logic presendence
author Kim Alvefur <zash@zash.se>
date Tue, 18 Oct 2016 14:59:02 +0200
parents 512e31cd8b70
children
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
874
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
17 plan tests => scalar(@users) + 3;
809
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 {
876
512e31cd8b70 Fix login failure test to use a non-existent user
Rob Hoelz <rob@hoelz.ro>
parents: 874
diff changeset
42 my $conn = TestConnection->new('invalid', password => '12345');
809
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 };
874
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
51
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
52 do {
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
53 my $conn = TestConnection->new('seven', password => '1234567');
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
54
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
55 $conn->reg_cb(session_ready => sub {
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
56 $conn->cond->send;
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
57 });
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
58
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
59 my $error = $conn->cond->recv;
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
60 ok($error);
a8e777e2d44f Test login for user 'seven'
Rob Hoelz <rob@hoelz.ro>
parents: 867
diff changeset
61 };