From 1e13c0c60c96dd1719e7c4c3931b4196c2b5bc61 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Fri, 30 Nov 2007 02:04:14 +0000 Subject: 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. --- perl/Wallet/Object/Keytab.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'perl/Wallet/Object/Keytab.pm') diff --git a/perl/Wallet/Object/Keytab.pm b/perl/Wallet/Object/Keytab.pm index f91abff..025c9e1 100644 --- a/perl/Wallet/Object/Keytab.pm +++ b/perl/Wallet/Object/Keytab.pm @@ -467,9 +467,11 @@ sub enctypes_list { while (defined ($entry = $sth->fetchrow_arrayref)) { push (@enctypes, @$entry); } + $self->{dbh}->commit; }; if ($@) { $self->error ($@); + $self->{dbh}->rollback; return; } return @enctypes; @@ -562,9 +564,11 @@ sub attr { while (defined ($target = $sth->fetchrow_array)) { push (@targets, $target); } + $self->{dbh}->commit; }; if ($@) { $self->error ($@); + $self->{dbh}->rollback; return; } return @targets; -- cgit v1.2.3