aboutsummaryrefslogtreecommitdiff
path: root/tests/server/admin-t
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2013-03-27 15:19:54 -0700
committerRuss Allbery <rra@stanford.edu>2013-03-27 15:19:54 -0700
commit5df16adc5024c56e3d733741919954308b4d498a (patch)
tree5f042adaaa988478ca271f41f9b272ef5a1b45b5 /tests/server/admin-t
parent431c3b56a52b9fe3135ab4339bada13ed49bda92 (diff)
parent6871bae8e26beadaff5035de56b4f70a78961dc9 (diff)
Merge tag 'upstream/1.0' into debian
Upstream version 1.0
Diffstat (limited to 'tests/server/admin-t')
-rwxr-xr-xtests/server/admin-t22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/server/admin-t b/tests/server/admin-t
index 5bde104..6846609 100755
--- a/tests/server/admin-t
+++ b/tests/server/admin-t
@@ -3,12 +3,13 @@
# Tests for the wallet-admin dispatch code.
#
# Written by Russ Allbery <rra@stanford.edu>
-# Copyright 2008, 2009, 2010 Board of Trustees, Leland Stanford Jr. University
+# Copyright 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 => 36;
+use Test::More tests => 42;
# Create a dummy class for Wallet::Admin that prints what method was called
# with its arguments and returns data for testing.
@@ -57,6 +58,12 @@ sub register_verifier {
return 1;
}
+sub upgrade {
+ print "upgrade\n";
+ return if $error;
+ return 1;
+}
+
# Back to the main package and the actual test suite. Lie about whether the
# Wallet::Admin package has already been loaded.
package main;
@@ -86,7 +93,8 @@ is ($out, "new\n", ' and nothing ran');
# Check too few and too many arguments for every command.
my %commands = (destroy => [0, 0],
initialize => [1, 1],
- register => [3, 3]);
+ register => [3, 3],
+ upgrade => [0, 0]);
for my $command (sort keys %commands) {
my ($min, $max) = @{ $commands{$command} };
if ($min > 0) {
@@ -150,6 +158,11 @@ is ($err, '', 'Register succeeds for verifier');
is ($out, "new\nregister_verifier foo Foo::Verifier\n",
' and returns the right outout');
+# Test upgrade.
+($out, $err) = run_admin ('upgrade');
+is ($err, '', 'Upgrade succeeds');
+is ($out, "new\nupgrade\n", ' and runs the right code');
+
# Test error handling.
$Wallet::Admin::error = 1;
($out, $err) = run_admin ('destroy');
@@ -169,3 +182,6 @@ is ($out, "new\nregister_object foo Foo::Object\n",
is ($err, "some error\n", 'Error handling succeeds for register verifier');
is ($out, "new\nregister_verifier foo Foo::Verifier\n",
' and calls the right methods');
+($out, $err) = run_admin ('upgrade');
+is ($err, "some error\n", 'Error handling succeeds for initialize');
+is ($out, "new\nupgrade\n", ' and calls the right methods');