diff options
| author | Russ Allbery <rra@stanford.edu> | 2010-06-29 15:38:31 -0700 | 
|---|---|---|
| committer | Russ Allbery <rra@stanford.edu> | 2010-06-29 15:38:31 -0700 | 
| commit | 906f0f88d64c4df501c2b84dbf6b7102de36d491 (patch) | |
| tree | 904ee92db1b107e0ae42aec3132b92d9ac3bef08 /perl/t | |
| parent | cd98777eb7904c30f1ffa792e10472e9b7b5051b (diff) | |
Update test suite for the addition of krb5-regex
Diffstat (limited to 'perl/t')
| -rwxr-xr-x | perl/t/schema.t | 2 | ||||
| -rwxr-xr-x | perl/t/verifier.t | 20 | 
2 files changed, 19 insertions, 3 deletions
| diff --git a/perl/t/schema.t b/perl/t/schema.t index 7f0aea4..40759db 100755 --- a/perl/t/schema.t +++ b/perl/t/schema.t @@ -21,7 +21,7 @@ ok (defined $schema, 'Wallet::Schema creation');  ok ($schema->isa ('Wallet::Schema'), ' and class verification');  my @sql = $schema->sql;  ok (@sql > 0, 'sql() returns something'); -is (scalar (@sql), 28, ' and returns the right number of statements'); +is (scalar (@sql), 29, ' and returns the right number of statements');  # Connect to a database and test create.  db_setup; diff --git a/perl/t/verifier.t b/perl/t/verifier.t index 74d7ba8..f56f5fa 100755 --- a/perl/t/verifier.t +++ b/perl/t/verifier.t @@ -3,14 +3,15 @@  # Tests for the basic wallet ACL verifiers.  #  # Written by Russ Allbery <rra@stanford.edu> -# Copyright 2007, 2008 Board of Trustees, Leland Stanford Jr. University +# Copyright 2007, 2008, 2010 Board of Trustees, Leland Stanford Jr. University  #  # See LICENSE for licensing terms. -use Test::More tests => 47; +use Test::More tests => 57;  use Wallet::ACL::Base;  use Wallet::ACL::Krb5; +use Wallet::ACL::Krb5::Regex;  use Wallet::ACL::NetDB;  use Wallet::ACL::NetDB::Root;  use Wallet::Config; @@ -39,6 +40,21 @@ 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'); +$verifier = Wallet::ACL::Krb5::Regex->new; +isa_ok ($verifier, 'Wallet::ACL::Krb5::Regex', 'krb5-regex verifier'); +is ($verifier->check ('rra@stanford.edu', '.*@stanford\.edu\z'), 1, +    'Simple check'); +is ($verifier->check ('rra@stanford.edu', '^a.*@stanford\.edu'), 0, +    'Simple failure'); +is ($verifier->error, undef, 'No error set'); +is ($verifier->check (undef, '^rra@stanford\.edu\z'), undef, +    'Undefined principal'); +is ($verifier->error, 'no principal specified', ' and right error'); +is ($verifier->check ('rra@stanford.edu', ''), undef, 'Empty ACL'); +is ($verifier->error, 'no ACL specified', ' and right error'); +is ($verifier->check ('rra@stanford.edu', '(rra'), undef, 'Malformed regex'); +is ($verifier->error, 'malformed krb5-regex ACL', ' and right error'); +  # Tests for the NetDB verifiers.  Skip these if we don't have a keytab or if  # we can't find remctld.  SKIP: { | 
