]>
Commit | Line | Data |
---|---|---|
7442fd06 MG |
1 | use v5.14; |
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use File::Temp qw/tempdir/; | |
6 | use Test::More tests => 5; | |
7 | BEGIN { use_ok('Apache2::AuthzCaps', qw/setcap hascaps/) }; | |
8 | ||
9 | $Apache2::AuthzCaps::rootdir = tempdir CLEANUP => 1; | |
10 | ||
11 | sub checkcaps{ | |
59f2225d MG |
12 | my ($user, $testname, @caps) = @_; |
13 | ok hascaps ($user, @caps), $testname | |
7442fd06 MG |
14 | } |
15 | ||
16 | sub checknocaps{ | |
59f2225d MG |
17 | my ($user, $testname, @caps) = @_; |
18 | ok !(hascaps $user, @caps), $testname | |
7442fd06 MG |
19 | } |
20 | ||
21 | setcap marius => dostuff => 1; | |
22 | checkcaps marius => 'Set cap and check it', qw/dostuff/; | |
23 | checknocaps marius => 'Check an inexistent cap', qw/dootherstuff/; | |
24 | ||
25 | setcap marius => goaway => 1; | |
26 | checkcaps marius => 'Check multiple caps', qw/dostuff goaway/; | |
27 | setcap marius => goaway => 0; | |
28 | checknocaps marius => 'Remove cap', qw/dostuff goaway/; |