aboutsummaryrefslogtreecommitdiff
path: root/perl/t/general
diff options
context:
space:
mode:
authorJon Robertson <jonrober@stanford.edu>2015-04-16 14:58:58 -0700
committerJon Robertson <jonrober@stanford.edu>2015-06-08 15:24:34 -0700
commit45a7c9d2896cf2e0d1548fd98b3b78f9f812744f (patch)
treea8fc5f7ec8ae6c634f80c404a3c015d9300f4987 /perl/t/general
parentf3da929ff35f24163ab56dbd9615ee6a1c5336d8 (diff)
wallet-report: Added report of all host-based objects for host
"wallet-report objects host <hostname>" reports on all objects that belong to the given host. This can be used to query things for retiring systems. Change-Id: Ib1c8e5978fed141d54ecc8504b56b43c037f9b17
Diffstat (limited to 'perl/t/general')
-rwxr-xr-xperl/t/general/report.t18
1 files changed, 17 insertions, 1 deletions
diff --git a/perl/t/general/report.t b/perl/t/general/report.t
index a63ab79..170fe29 100755
--- a/perl/t/general/report.t
+++ b/perl/t/general/report.t
@@ -11,7 +11,7 @@
use strict;
use warnings;
-use Test::More tests => 215;
+use Test::More tests => 218;
use Wallet::Admin;
use Wallet::Report;
@@ -281,6 +281,22 @@ is (scalar (@lines), 1, 'Searching for ACL naming violations finds one');
is ($lines[0][0], 3, ' and the first has the right ID');
is ($lines[0][1], 'second', ' and the right name');
+# Set a host-based object matching script so that we can test the host report.
+# The deactivation trick isn't needed here.
+package Wallet::Config;
+sub is_for_host {
+ my ($type, $name, $host) = @_;
+ my ($service, $principal) = split ('/', $name, 2);
+ return 0 unless $service && $principal;
+ return 1 if $host eq $principal;
+ return 0;
+}
+package main;
+@lines = $report->objects_hostname ('host', 'admin');
+is (scalar (@lines), 1, 'Searching for host-based objects finds one');
+is ($lines[0][0], 'base', ' and the first has the right type');
+is ($lines[0][1], 'service/admin', ' and the right name');
+
# Set up a file bucket so that we can create an object we can retrieve.
system ('rm -rf test-files') == 0 or die "cannot remove test-files\n";
mkdir 'test-files' or die "cannot create test-files: $!\n";