Software /
code /
prosody-modules
Annotate
mod_lib_ldap/dev/t/00-login.t @ 2387:5bfb2ccab2ab
mod_firewall: README: Add more info about specifying rule set files
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 19 Nov 2016 15:59:31 +0000 |
parent | 876:512e31cd8b70 |
rev | line source |
---|---|
809 | 1 use strict; |
2 use warnings; | |
3 use lib 't'; | |
4 | |
5 use TestConnection; | |
6 use Test::More; | |
7 | |
8 my @users = ( | |
9 'one', | |
10 'two', | |
11 'three', | |
12 'four', | |
13 'five', | |
866 | 14 'six', |
809 | 15 ); |
16 | |
874 | 17 plan tests => scalar(@users) + 3; |
809 | 18 |
19 foreach my $username (@users) { | |
20 my $conn = TestConnection->new($username); | |
21 | |
22 $conn->reg_cb(session_ready => sub { | |
23 $conn->cond->send; | |
24 }); | |
25 | |
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 | 28 } |
29 | |
30 do { | |
31 my $conn = TestConnection->new('one', password => '23451'); | |
32 | |
33 $conn->reg_cb(session_ready => sub { | |
34 $conn->cond->send; | |
35 }); | |
36 | |
37 my $error = $conn->cond->recv; | |
38 ok($error); | |
39 }; | |
40 | |
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 | 43 |
44 $conn->reg_cb(session_ready => sub { | |
45 $conn->cond->send; | |
46 }); | |
47 | |
48 my $error = $conn->cond->recv; | |
49 ok($error); | |
50 }; | |
874 | 51 |
52 do { | |
53 my $conn = TestConnection->new('seven', password => '1234567'); | |
54 | |
55 $conn->reg_cb(session_ready => sub { | |
56 $conn->cond->send; | |
57 }); | |
58 | |
59 my $error = $conn->cond->recv; | |
60 ok($error); | |
61 }; |