summaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-09-17 16:29:07 +0000
committerRuss Allbery <rra@stanford.edu>2007-09-17 16:29:07 +0000
commita385775cf0f1645d393f249c4a3b086c8b1d8a42 (patch)
tree8917efe6b482463128505040a3a10bb001a09af3 /tests/server
parent66298af6358804e674748787cc0ccb642a63db3a (diff)
Add an acl show command to the front end that calls the appropriate
Wallet::Server method.
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/backend-t.in20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/server/backend-t.in b/tests/server/backend-t.in
index c509fff..408cb0f 100644
--- a/tests/server/backend-t.in
+++ b/tests/server/backend-t.in
@@ -5,7 +5,7 @@
use strict;
use IO::String;
-use Test::More tests => 710;
+use Test::More tests => 720;
# Create a dummy class for Wallet::Server that prints what method was called
# with its arguments and returns data for testing.
@@ -41,6 +41,13 @@ sub acl_remove
sub acl_rename
{ shift; print "acl_rename @_\n"; ($_[0] eq 'error') ? undef : 1 }
+sub acl_show {
+ shift;
+ print "acl_show @_\n";
+ return if $_[0] eq 'error';
+ return 'acl_show';
+}
+
sub acl {
shift;
print "acl @_\n";
@@ -147,7 +154,8 @@ my %acl_commands = (add => [3, 3],
create => [1, 1],
destroy => [1, 1],
remove => [3, 3],
- rename => [2, 2]);
+ rename => [2, 2],
+ show => [1, 1]);
for my $command (sort keys %commands) {
my ($min, $max) = @{ $commands{$command} };
($out, $err) = run_backend ($command, ('foo') x ($min - 1));
@@ -245,7 +253,13 @@ for my $command (sort keys %acl_commands) {
my $extra = @extra ? join (' ', '', @extra) : '';
($out, $err) = run_backend ('acl', $command, 'name', @extra);
is ($err, '', "Command acl $command ran with no errors");
- is ($out, "$new\nacl_$command name$extra\n", ' and ran the right method');
+ my $expected;
+ if ($command eq 'show') {
+ $expected = "$new\nacl_$command name$extra\nacl_show";
+ } else {
+ $expected = "$new\nacl_$command name$extra\n";
+ }
+ is ($out, $expected, ' and ran the right method');
($out, $err) = run_backend ('acl', $command, 'error', @extra);
is ($err, "error count $error\n", "Command acl $command ran with errors");
is ($out, "$new\nacl_$command error$extra\n",