diff options
author | Russ Allbery <rra@stanford.edu> | 2007-05-02 23:12:30 +0000 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2007-05-02 23:12:30 +0000 |
commit | 81ba1afddb1f008c28fad84aa4f3b80ef2de247c (patch) | |
tree | 57f239cd1a48e4c1ed684708f3929d7953bf4fbc /perl | |
parent | f758ea1eb109911e2b06191c7a204ce6269e0447 (diff) |
Add a test suite for the new ACL modules and declare $VERSION so that
they'll load properly.
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Wallet/ACL.pm | 1 | ||||
-rw-r--r-- | perl/Wallet/ACL/Krb5.pm | 2 | ||||
-rwxr-xr-x | perl/t/acl.t | 30 |
3 files changed, 32 insertions, 1 deletions
diff --git a/perl/Wallet/ACL.pm b/perl/Wallet/ACL.pm index d22385e..5258d85 100644 --- a/perl/Wallet/ACL.pm +++ b/perl/Wallet/ACL.pm @@ -14,6 +14,7 @@ package Wallet::ACL; require 5.006; use strict; +use vars qw($VERSION); # This version should be increased on any code change to this module. Always # use two digits for the minor version with a leading zero if necessary so diff --git a/perl/Wallet/ACL/Krb5.pm b/perl/Wallet/ACL/Krb5.pm index c5e8527..e8d8921 100644 --- a/perl/Wallet/ACL/Krb5.pm +++ b/perl/Wallet/ACL/Krb5.pm @@ -14,7 +14,7 @@ package Wallet::ACL::Krb5; require 5.006; use strict; -use vars qw(@ISA); +use vars qw(@ISA $VERSION); @ISA = qw(Wallet::ACL); diff --git a/perl/t/acl.t b/perl/t/acl.t new file mode 100755 index 0000000..7d5f230 --- /dev/null +++ b/perl/t/acl.t @@ -0,0 +1,30 @@ +#!/usr/bin/perl -w +# $Id$ +# +# t/acl.t -- Tests for the wallet ACL verifiers. + +use Test::More tests => 13; + +use Wallet::ACL; +use Wallet::ACL::Krb5; + +my $verifier = Wallet::ACL->new; +ok (defined $verifier, 'Wallet::ACL creation'); +ok ($verifier->isa ('Wallet::ACL'), ' and class verification'); +is ($verifier->check ('rra@stanford.edu', 'rra@stanford.edu'), 0, + 'Default check declines'); +is ($verifier->error, undef, 'No error set'); + +$verifier = Wallet::ACL::Krb5->new; +ok (defined $verifier, 'Wallet::ACL::Krb5 creation'); +ok ($verifier->isa ('Wallet::ACL::Krb5'), ' and class verification'); +is ($verifier->check ('rra@stanford.edu', 'rra@stanford.edu'), 1, + 'Simple check'); +is ($verifier->check ('rra@stanford.edu', 'thoron@stanford.edu'), 0, + 'Simple failure'); +is ($verifier->error, undef, 'No error set'); +is ($verifier->check (undef, 'rra@stanford.edu'), undef, + 'Undefined principal'); +is ($verifier->error, 'no principal specified', ' and right error'); +is ($verifier->check ('rra@stanford.edu', ''), undef, 'Empty ACL'); +is ($verifier->error, 'malformed krb5 ACL', ' and right error'); |