From 45823559a1e64d6c8151a984fcd9c79bbdb57171 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Thu, 7 Feb 2008 06:37:11 +0000 Subject: 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. --- tests/server/backend-t.in | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'tests/server/backend-t.in') 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); -- cgit v1.2.3