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