diff options
Diffstat (limited to 'tests/server')
| -rwxr-xr-x | tests/server/backend-t | 18 | ||||
| -rwxr-xr-x | tests/server/report-t | 10 | 
2 files changed, 22 insertions, 6 deletions
diff --git a/tests/server/backend-t b/tests/server/backend-t index b58d02c..a618391 100755 --- a/tests/server/backend-t +++ b/tests/server/backend-t @@ -289,11 +289,19 @@ for my $command (sort keys %acl_commands) {          my @args = @base;          $args[$arg] = 'foo;bar';          ($out, $err) = run_backend ('acl', $command, @args); -        is ($err, "invalid characters in argument: foo;bar\n", -            "Invalid arguments for acl $command $arg"); -        is ($OUTPUT, "error for admin (1.2.3.4): invalid characters in" -            . " argument: foo;bar\n", ' and syslog correct'); -        is ($out, "$new\n", ' and nothing ran'); +        if (($command eq 'add' or $command eq 'remove') and $arg == 2) { +            is ($err, '', 'Add/remove allows any characters'); +            is ($OUTPUT, "command acl $command @args[0..2] from admin" +                . " (1.2.3.4) succeeded\n", ' and success logged'); +            is ($out, "$new\nacl_$command @args[0..2]\n", +                ' and calls the right method'); +        } else { +            is ($err, "invalid characters in argument: foo;bar\n", +                "Invalid arguments for acl $command $arg"); +            is ($OUTPUT, "error for admin (1.2.3.4): invalid characters in" +                . " argument: foo;bar\n", ' and syslog correct'); +            is ($out, "$new\n", ' and nothing ran'); +        }      }  }  for my $command (sort keys %flag_commands) { diff --git a/tests/server/report-t b/tests/server/report-t index 394a869..0771946 100755 --- a/tests/server/report-t +++ b/tests/server/report-t @@ -8,7 +8,7 @@  # See LICENSE for licensing terms.  use strict; -use Test::More tests => 44; +use Test::More tests => 48;  # Create a dummy class for Wallet::Report that prints what method was called  # with its arguments and returns data for testing. @@ -35,6 +35,7 @@ sub acls {      shift;      print "acls @_\n";      return if ($error or $empty); +    return ([ qw/d1 d2 d3/ ], [ qw/o1 o2/ ]) if (@_ && $_[0] eq 'duplicate');      return ([ 1, 'ADMIN' ], [ 2, 'group/admins' ], [ 4, 'group/users' ]);  } @@ -119,6 +120,10 @@ is ($err, '', 'List succeeds for ACLs');  is ($out, "new\nacls \n"      . "ADMIN (ACL ID: 1)\ngroup/admins (ACL ID: 2)\ngroup/users (ACL ID: 4)\n",      ' and returns the right output'); +($out, $err) = run_report ('acls', 'duplicate'); +is ($err, '', 'Duplicate report succeeds for ACLs'); +is ($out, "new\nacls duplicate\nd1 d2 d3\no1 o2\n", +    ' and returns the right output');  ($out, $err) = run_report ('acls', 'entry', 'foo', 'foo');  is ($err, '', 'List succeeds for ACLs');  is ($out, "new\nacls entry foo foo\n" @@ -168,6 +173,9 @@ $Wallet::Report::empty = 1;  ($out, $err) = run_report ('acls');  is ($err, '', 'acls runs with an empty list and no errors');  is ($out, "new\nacls \n", ' and calls the right methods'); +($out, $err) = run_report ('acls', 'duplicate'); +is ($err, '', 'acls duplicate runs with an empty list and no errors'); +is ($out, "new\nacls duplicate\n", ' and calls the right methods');  ($out, $err) = run_report ('audit', 'objects', 'name');  is ($err, '', 'audit runs with an empty list and no errors');  is ($out, "new\naudit objects name\n", ' and calls the right methods');  | 
