Fix previous release
[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;
7BEGIN { use_ok('Apache2::Authen::Passphrase', qw/pwset pwcheck/) };
8
f7fdbaad 9$Apache2::Authen::Passphrase::rootdir = tempdir CLEANUP => 1;
f4cc782b
MG
10
11sub pw_ok {
12 my ($user, $pass, $testname) = @_;
13 eval { pwcheck $user, $pass };
14 is $@, '', $testname;
15}
16
17sub pw_nok {
18 my ($user, $pass, $testname) = @_;
19 eval { pwcheck $user, $pass };
20 isnt $@, '', $testname;
21}
22
23pwset marius => 'password';
24pw_ok marius => 'password', 'Set password and check it';
25pw_nok marius => 'anotherpassword', 'Check an incorrect password';
26
27pwset marius => 'anotherpassword';
28pw_ok marius => 'anotherpassword', 'Change the password and check it';
29
30pw_nok 'BadUsername++', 'a', 'Bad username';
31pw_nok 'a', 'a', 'Short username';
32pw_nok 'asfwe0g3girg4ih45jho45ih45hi45h045jh4oh', 'a', 'Long username';
This page took 0.010101 seconds and 4 git commands to generate.