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/Wallet/ACL.pm | 1 + perl/Wallet/ACL/Krb5.pm | 2 +- perl/t/acl.t | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 perl/t/acl.t (limited to 'perl') 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'); -- cgit v1.2.3