5 use File::Temp qw/tempdir/;
6 use Test::More tests => 7;
7 BEGIN { use_ok('Apache2::Authen::Passphrase', qw/pwset pwcheck/) };
9 my $tempdir = tempdir CLEANUP => 1;
11 $Apache2::Authen::Passphrase::rootdir = $tempdir;
14 my ($user, $pass, $testname) = @_;
15 eval { pwcheck $user, $pass };
20 my ($user, $pass, $testname) = @_;
21 eval { pwcheck $user, $pass };
22 isnt $@, '', $testname;
25 pwset marius => 'password';
26 pw_ok marius => 'password', 'Set password and check it';
27 pw_nok marius => 'anotherpassword', 'Check an incorrect password';
29 pwset marius => 'anotherpassword';
30 pw_ok marius => 'anotherpassword', 'Change the password and check it';
32 pw_nok 'BadUsername++', 'a', 'Bad username';
33 pw_nok 'a', 'a', 'Short username';
34 pw_nok 'asfwe0g3girg4ih45jho45ih45hi45h045jh4oh', 'a', 'Long username';