summaryrefslogtreecommitdiff
path: root/perl/t
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-05-02 23:12:30 +0000
committerRuss Allbery <rra@stanford.edu>2007-05-02 23:12:30 +0000
commit81ba1afddb1f008c28fad84aa4f3b80ef2de247c (patch)
tree57f239cd1a48e4c1ed684708f3929d7953bf4fbc /perl/t
parentf758ea1eb109911e2b06191c7a204ce6269e0447 (diff)
Add a test suite for the new ACL modules and declare $VERSION so that
they'll load properly.
Diffstat (limited to 'perl/t')
-rwxr-xr-xperl/t/acl.t30
1 files changed, 30 insertions, 0 deletions
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');