diff options
Diffstat (limited to 'tests/server')
| -rwxr-xr-x | tests/server/backend-t | 32 | 
1 files changed, 25 insertions, 7 deletions
| diff --git a/tests/server/backend-t b/tests/server/backend-t index a618391..3e377a1 100755 --- a/tests/server/backend-t +++ b/tests/server/backend-t @@ -3,13 +3,13 @@  # Tests for the wallet-backend dispatch code.  #  # Written by Russ Allbery <rra@stanford.edu> -# Copyright 2006, 2007, 2008, 2009, 2010 -#     Board of Trustees, Leland Stanford Jr. University +# Copyright 2006, 2007, 2008, 2009, 2010, 2011 +#     The Board of Trustees of the Leland Stanford Junior University  #  # See LICENSE for licensing terms.  use strict; -use Test::More tests => 1269; +use Test::More tests => 1296;  # Create a dummy class for Wallet::Server that prints what method was called  # with its arguments and returns data for testing. @@ -110,6 +110,19 @@ sub check {      }  } +sub comment { +    shift; +    print "comment @_\n"; +    if ($_[0] eq 'error') { +        return; +    } elsif ($_[1] eq 'empty') { +        $okay = 1; +        return; +    } else { +        return 'comment'; +    } +} +  sub expires {      shift;      print "expires @_\n"; @@ -216,6 +229,7 @@ is ($out, "$new\n", ' and nothing ran');  # Check too few, too many, and bad arguments for every command.  my %commands = (autocreate => [2, 2],                  check      => [2, 2], +                comment    => [2, 3],                  create     => [2, 2],                  destroy    => [2, 2],                  expires    => [2, 4], @@ -363,7 +377,8 @@ for my $command (qw/autocreate create destroy setacl setattr store/) {          ' and ran the right method');      $error++;  } -for my $command (qw/check expires get getacl getattr history owner show/) { +for my $command (qw/check comment expires get getacl getattr history owner +                    show/) {      my $method = { getacl => 'acl', getattr => 'attr' }->{$command};      $method ||= $command;      my @extra = ('foo') x ($commands{$command}[0] - 2); @@ -384,7 +399,8 @@ for my $command (qw/check expires get getacl getattr history owner show/) {          is ($out, "$new\n$method type name$extra\n$method$newline",              ' and ran the right method with output');      } -    if ($command eq 'expires' or $command eq 'owner') { +    if ($command eq 'expires' or $command eq 'owner' +        or $command eq 'comment') {          ($out, $err) = run_backend ($command, 'type', 'name', @extra, 'foo');          my $ran = "$command type name" . (@extra ? " @extra" : '') . ' foo';          is ($err, '', "Command $command ran with no errors (setting)"); @@ -393,14 +409,16 @@ for my $command (qw/check expires get getacl getattr history owner show/) {          is ($out, "$new\n$method type name$extra foo\n",              ' and ran the right method');      } -    if ($command eq 'expires' or $command eq 'getacl' or $command eq 'owner') { +    if ($command eq 'expires' or $command eq 'getacl' +        or $command eq 'owner' or $command eq 'comment') {          ($out, $err) = run_backend ($command, 'type', 'empty', @extra);          my $ran = "$command type empty" . (@extra ? " @extra" : '');          is ($err, '', "Command $command ran with no errors (empty)");          is ($OUTPUT, "command $ran from admin (1.2.3.4) succeeded\n",              ' and success logged');          my $desc; -        if    ($command eq 'expires') { $desc = 'expiration' } +        if    ($command eq 'comment') { $desc = 'comment' } +        elsif ($command eq 'expires') { $desc = 'expiration' }          elsif ($command eq 'getacl')  { $desc = 'ACL' }          elsif ($command eq 'owner')   { $desc = 'owner' }          is ($out, "$new\n$method type empty$extra\nNo $desc set\n", | 
