aboutsummaryrefslogtreecommitdiff
path: root/perl/t/verifier/external.t
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2016-01-17 19:43:10 -0800
committerRuss Allbery <eagle@eyrie.org>2016-01-17 19:43:10 -0800
commit4b3f858ef567c0d12511e7fea2a56f08f2729635 (patch)
treee1cad1c445669045b47264c8957878352c7adc03 /perl/t/verifier/external.t
parent7856dc7cc5e16140c0084474fe54338f293bf77e (diff)
parent76f93739a8a933d98b87db9496861dae7de0ae1a (diff)
Imported Upstream version 1.3upstream/1.3
Diffstat (limited to 'perl/t/verifier/external.t')
-rwxr-xr-xperl/t/verifier/external.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/perl/t/verifier/external.t b/perl/t/verifier/external.t
new file mode 100755
index 0000000..d1438de
--- /dev/null
+++ b/perl/t/verifier/external.t
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+#
+# Tests for the external wallet ACL verifier.
+#
+# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2016 Russ Allbery <eagle@eyrie.org>
+#
+# See LICENSE for licensing terms.
+
+use strict;
+use warnings;
+
+use Test::More tests => 9;
+
+use Wallet::ACL::External;
+use Wallet::Config;
+
+# Configure the external ACL verifier.
+$Wallet::Config::EXTERNAL_COMMAND = 't/data/acl-command';
+
+# Check a few verifications.
+my $verifier = Wallet::ACL::External->new;
+ok (defined $verifier, 'Wallet::ACL::External creation');
+ok ($verifier->isa ('Wallet::ACL::External'), ' and class verification');
+is ($verifier->check ('eagle@eyrie.org', 'test success', 'file', 'test'),
+ 1, 'Success');
+is ($verifier->check ('eagle@eyrie.org', 'test failure', 'file', 'test'),
+ 0, 'Failure');
+is ($verifier->error, undef, 'No error set');
+is ($verifier->check ('eagle@eyrie.org', 'test error', 'file', 'test'),
+ undef, 'Error');
+is ($verifier->error, 'some error', ' and right error');
+is ($verifier->check (undef, 'eagle@eyrie.org', 'file', 'test'), undef,
+ 'Undefined principal');
+is ($verifier->error, 'no principal specified', ' and right error');