summaryrefslogtreecommitdiff
path: root/perl/t/keytab.t
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-12-01 00:42:46 +0000
committerRuss Allbery <rra@stanford.edu>2007-12-01 00:42:46 +0000
commitc9948c8f68b11a1e897afe9c9f2dd2fcb6934f8d (patch)
treef15323beb5ceac6a2b81df8634f5f9f23ad239c8 /perl/t/keytab.t
parent1e13c0c60c96dd1719e7c4c3931b4196c2b5bc61 (diff)
The wallet backend test suite now supports using a database other than
SQLite for testing. Also start a new Util.pm module for the test suite and move the contents sub into that module. More to follow.
Diffstat (limited to 'perl/t/keytab.t')
-rwxr-xr-xperl/t/keytab.t20
1 files changed, 5 insertions, 15 deletions
diff --git a/perl/t/keytab.t b/perl/t/keytab.t
index f08bd31..c7b333c 100755
--- a/perl/t/keytab.t
+++ b/perl/t/keytab.t
@@ -15,6 +15,9 @@ use Wallet::Config;
use Wallet::Object::Keytab;
use Wallet::Server;
+use lib 't/lib';
+use Util;
+
# Mapping of klist -ke encryption type names to the strings that Kerberos uses
# internally. It's very annoying to have to maintain this, and it probably
# breaks with Heimdal.
@@ -25,11 +28,6 @@ my %enctype =
'aes-256 cts mode with 96-bit sha-1 hmac' => 'aes256-cts',
'arcfour with hmac/md5' => 'rc4-hmac');
-# Use a local SQLite database for testing.
-$Wallet::Config::DB_DRIVER = 'SQLite';
-$Wallet::Config::DB_INFO = 'wallet-db';
-unlink ('wallet-db', 'krb5cc_temp', 'krb5cc_test', 'test-acl', 'test-pid');
-
# Some global defaults to use.
my $user = 'admin@EXAMPLE.COM';
my $host = 'localhost';
@@ -38,16 +36,6 @@ my @trace = ($user, $host, time);
# Flush all output immediately.
$| = 1;
-# Returns the one-line contents of a file as a string, removing the newline.
-sub contents {
- my ($file) = @_;
- open (FILE, '<', $file) or die "cannot open $file: $!\n";
- my $data = <FILE>;
- close FILE;
- chomp $data;
- return $data;
-}
-
# Run a command and throw away the output, returning the exit status.
sub system_quiet {
my ($command, @args) = @_;
@@ -200,6 +188,8 @@ sub stop_remctld {
}
# Use Wallet::Server to set up the database.
+unlink ('krb5cc_temp', 'krb5cc_test', 'test-acl', 'test-pid');
+db_setup;
my $server = eval { Wallet::Server->reinitialize ($user) };
is ($@, '', 'Database initialization did not die');
ok ($server->isa ('Wallet::Server'), ' and returned the right class');