summaryrefslogtreecommitdiff
path: root/perl/t/verifier.t
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-08-30 04:47:58 +0000
committerRuss Allbery <rra@stanford.edu>2007-08-30 04:47:58 +0000
commitadff8e50167c1abf64ec892f70e84ce0dd76ab8b (patch)
treecf5cc5bbdf06a73302aa631d10e9281c0a5f5f30 /perl/t/verifier.t
parenta0e3892a6e4865a36ac3848d640198dc3a25d6c1 (diff)
Rename acl.t to verifier.t to free up acl.t for tests of the more general
ACL interface.
Diffstat (limited to 'perl/t/verifier.t')
-rwxr-xr-xperl/t/verifier.t30
1 files changed, 30 insertions, 0 deletions
diff --git a/perl/t/verifier.t b/perl/t/verifier.t
new file mode 100755
index 0000000..79bb16b
--- /dev/null
+++ b/perl/t/verifier.t
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -w
+# $Id$
+#
+# t/verifier.t -- Tests for the basic wallet ACL verifiers.
+
+use Test::More tests => 13;
+
+use Wallet::ACL::Base;
+use Wallet::ACL::Krb5;
+
+my $verifier = Wallet::ACL::Base->new;
+ok (defined $verifier, 'Wallet::ACL::Base creation');
+ok ($verifier->isa ('Wallet::ACL::Base'), ' 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');