File: external.t

package info (click to toggle)
krb5-wallet 1.7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,192 kB
  • sloc: perl: 13,083; ansic: 6,287; sh: 2,373; sql: 1,884; makefile: 274
file content (34 lines) | stat: -rwxr-xr-x 1,104 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl
#
# Tests for the external wallet ACL verifier.
#
# Copyright 2016 Russ Allbery <eagle@eyrie.org>
#
# SPDX-License-Identifier: MIT

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');