]> iEval git - apache2-authen-passphrase.git/blame_incremental - t/Apache2-Authen-Passphrase.t
Bump version and update Changes
[apache2-authen-passphrase.git] / t / Apache2-Authen-Passphrase.t
... / ...
CommitLineData
1use v5.14;
2use strict;
3use warnings;
4
5use File::Temp qw/tempdir/;
6use Test::More tests => 7;
7BEGIN { $ENV{AAP_ROOTDIR} = tempdir CLEANUP => 1 }
8BEGIN { use_ok('Apache2::Authen::Passphrase', qw/pwset pwcheck/) };
9
10sub pw_ok {
11 my ($user, $pass, $testname) = @_;
12 eval { pwcheck $user, $pass };
13 is $@, '', $testname;
14}
15
16sub pw_nok {
17 my ($user, $pass, $testname) = @_;
18 eval { pwcheck $user, $pass };
19 isnt $@, '', $testname;
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.025812 seconds and 5 git commands to generate.