From c940a0f4716b0c8048c46ab3e783f543d190eed6 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Wed, 10 Oct 2007 23:20:53 +0000 Subject: Add a history method to the Wallet::ACL API. --- perl/t/acl.t | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'perl/t') diff --git a/perl/t/acl.t b/perl/t/acl.t index 644ea3e..bd055d2 100755 --- a/perl/t/acl.t +++ b/perl/t/acl.t @@ -8,7 +8,8 @@ # # See LICENSE for licensing terms. -use Test::More tests => 100; +use POSIX qw(strftime); +use Test::More tests => 101; use Wallet::ACL; use Wallet::Config; @@ -24,7 +25,7 @@ my $admin = 'admin@EXAMPLE.COM'; my $user1 = 'alice@EXAMPLE.COM'; my $user2 = 'bob@EXAMPLE.COM'; my $host = 'localhost'; -my @trace = ($admin, $host); +my @trace = ($admin, $host, time); # Use Wallet::Server to set up the database. my $server = eval { Wallet::Server->initialize ($admin) }; @@ -187,6 +188,26 @@ is ($acl->show, "Members of ACL example (id: 2) are:\n", ' and show concurs'); is ($acl->check ($user2), 0, ' and the second user check fails'); is (scalar ($acl->check_errors), '', ' with no error message'); +# Test history. +my $date = strftime ('%Y-%m-%d %H:%M:%S', localtime $trace[2]); +my $history = <<"EOO"; +$date create + by $admin from $host +$date add krb5 $user1 + by $admin from $host +$date add krb5 $user2 + by $admin from $host +$date remove krb5 $user1 + by $admin from $host +$date add krb5 + by $admin from $host +$date remove krb5 $user2 + by $admin from $host +$date remove krb5 + by $admin from $host +EOO +is ($acl->history, $history, 'History is correct'); + # Test destroy. if ($acl->destroy (@trace)) { ok (1, 'Destroying the ACL works'); -- cgit v1.2.3