summaryrefslogtreecommitdiff
path: root/perl/t/server.t
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-11-30 02:04:14 +0000
committerRuss Allbery <rra@stanford.edu>2007-11-30 02:04:14 +0000
commit1e13c0c60c96dd1719e7c4c3931b4196c2b5bc61 (patch)
treed322cd4ea3257d9c95a2afd06da856de8d8bd87a /perl/t/server.t
parent1cc39c41c7cd2a682d024526f4fe933f7e7722da (diff)
Initial work on supporting testing with MySQL.
Add a drop() method to Wallet::Schema to destroy the wallet database. Add a test suite for it. Add a reinitialize() method to Wallet;:Server that drops the database before creating it. Modify the wallet object test cases to call reinitialize() to create the initial database and drop() to clean up the database after the test is complete. Fix a bug preventing Wallet::Schema from being initialized multiple times. We now stash the schema in a class static variable and reuse it for subsequent initializations, since re-reading DATA doesn't work.
Diffstat (limited to 'perl/t/server.t')
-rwxr-xr-xperl/t/server.t8
1 files changed, 5 insertions, 3 deletions
diff --git a/perl/t/server.t b/perl/t/server.t
index b0c196b..2520e62 100755
--- a/perl/t/server.t
+++ b/perl/t/server.t
@@ -866,6 +866,11 @@ is ($server->store ('base', 'service/foo', 'stuff'), undef,
is ($server->error, "$user2 not authorized to create base:service/foo",
' with the right error');
+# Clean up.
+my $schema = Wallet::Schema->new;
+$schema->drop ($server->dbh);
+unlink 'wallet-db';
+
# Now test handling of some configuration errors.
undef $Wallet::Config::DB_DRIVER;
$server = eval { Wallet::Server->new ($user2, $host) };
@@ -880,6 +885,3 @@ $Wallet::Config::DB_INFO = 't';
$server = eval { Wallet::Server->new ($user2, $host) };
like ($@, qr/^cannot connect to database: /,
' or if the database connection fails');
-
-# Clean up.
-unlink 'wallet-db';