From 81ba1afddb1f008c28fad84aa4f3b80ef2de247c Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Wed, 2 May 2007 23:12:30 +0000 Subject: Add a test suite for the new ACL modules and declare $VERSION so that they'll load properly. --- perl/t/acl.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 perl/t/acl.t (limited to 'perl/t') 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'); -- cgit v1.2.3