aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2008-02-07 06:37:11 +0000
committerRuss Allbery <rra@stanford.edu>2008-02-07 06:37:11 +0000
commit45823559a1e64d6c8151a984fcd9c79bbdb57171 (patch)
treeace7573730be9f9eb6aec7676c8a2d4ac2ccb998 /tests
parent428c88bb0a08ba2eb06c7f5181f7cbee2f7ee398 (diff)
Add a new autocreate API call that tries to create an object using the
default ACLs. Remove autocreation support from create, which now requires that one be on the ADMIN ACL, and from get and store. The wallet client will soon know how to do the right thing.
Diffstat (limited to 'tests')
-rw-r--r--tests/server/backend-t.in37
1 files changed, 22 insertions, 15 deletions
diff --git a/tests/server/backend-t.in b/tests/server/backend-t.in
index 3047ebd..0b65c07 100644
--- a/tests/server/backend-t.in
+++ b/tests/server/backend-t.in
@@ -10,7 +10,7 @@
use strict;
use IO::String;
-use Test::More tests => 1245;
+use Test::More tests => 1263;
# Create a dummy class for Wallet::Server that prints what method was called
# with its arguments and returns data for testing.
@@ -93,6 +93,12 @@ sub attr {
}
}
+sub autocreate {
+ shift;
+ print "autocreate @_\n";
+ return ($_[0] eq 'error') ? undef : 1
+}
+
sub check {
shift;
print "check @_\n";
@@ -206,19 +212,20 @@ is ($OUTPUT, "error for admin (1.2.3.4): unknown command flag foo\n",
is ($out, "$new\n", ' and nothing ran');
# Check too few, too many, and bad arguments for every command.
-my %commands = (check => [2, 2],
- create => [2, 2],
- destroy => [2, 2],
- expires => [2, 4],
- get => [2, 2],
- getacl => [3, 3],
- getattr => [3, 3],
- history => [2, 2],
- owner => [2, 3],
- setacl => [4, 4],
- setattr => [4, 9],
- show => [2, 2],
- store => [3, 3]);
+my %commands = (autocreate => [2, 2],
+ check => [2, 2],
+ create => [2, 2],
+ destroy => [2, 2],
+ expires => [2, 4],
+ get => [2, 2],
+ getacl => [3, 3],
+ getattr => [3, 3],
+ history => [2, 2],
+ owner => [2, 3],
+ setacl => [4, 4],
+ setattr => [4, 9],
+ show => [2, 2],
+ store => [3, 3]);
my %acl_commands = (add => [3, 3],
create => [1, 1],
destroy => [1, 1],
@@ -315,7 +322,7 @@ for my $command (sort keys %flag_commands) {
# Now, test that we ran the right functions and passed the correct arguments.
my $error = 1;
-for my $command (qw/create destroy setacl setattr store/) {
+for my $command (qw/autocreate create destroy setacl setattr store/) {
my $method = { setacl => 'acl', setattr => 'attr' }->{$command};
$method ||= $command;
my @extra = ('foo') x ($commands{$command}[0] - 2);