]> iEval git - apache2-authen-passphrase.git/blob - t/Apache2-Authen-Passphrase.t
820b84393a19c2f305b9fcdd986c31cc9cf12711
[apache2-authen-passphrase.git] / t / Apache2-Authen-Passphrase.t
1 use v5.14;
2 use strict;
3 use warnings;
4
5 use File::Temp qw/tempdir/;
6 use Test::More tests => 7;
7 BEGIN { $ENV{AAP_ROOTDIR} = tempdir CLEANUP => 1 }
8 BEGIN { use_ok('Apache2::Authen::Passphrase', qw/pwset pwcheck/) };
9
10 sub pw_ok {
11 my ($user, $pass, $testname) = @_;
12 eval { pwcheck $user, $pass };
13 is $@, '', $testname;
14 }
15
16 sub pw_nok {
17 my ($user, $pass, $testname) = @_;
18 eval { pwcheck $user, $pass };
19 isnt $@, '', $testname;
20 }
21
22 pwset marius => 'password';
23 pw_ok marius => 'password', 'Set password and check it';
24 pw_nok marius => 'anotherpassword', 'Check an incorrect password';
25
26 pwset marius => 'anotherpassword';
27 pw_ok marius => 'anotherpassword', 'Change the password and check it';
28
29 pw_nok 'BadUsername++', 'a', 'Bad username';
30 pw_nok 'a', 'a', 'Short username';
31 pw_nok 'asfwe0g3girg4ih45jho45ih45hi45h045jh4oh', 'a', 'Long username';
This page took 0.048966 seconds and 5 git commands to generate.