From 55b5f343655e1e4e320f145010d043f73b9ef97b Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 21 May 2012 18:06:22 -0400 Subject: [PATCH] auth_vpopmail_sql test, eval 'use DBI' before testing --- t/plugin_tests/auth/auth_vpopmail | 2 +- t/plugin_tests/auth/auth_vpopmail_sql | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/t/plugin_tests/auth/auth_vpopmail b/t/plugin_tests/auth/auth_vpopmail index fb9c724..5213890 100644 --- a/t/plugin_tests/auth/auth_vpopmail +++ b/t/plugin_tests/auth/auth_vpopmail @@ -23,7 +23,7 @@ sub test_auth_vpopmail { if ( ! $self->test_vpopmail_module ) { warn "vpopmail plugin not configured\n"; - foreach ( 0..2) { ok( 1, "test_auth_vpopmail, skipped") }; + foreach ( 0..2) { ok( 1, "skipped") }; return; }; diff --git a/t/plugin_tests/auth/auth_vpopmail_sql b/t/plugin_tests/auth/auth_vpopmail_sql index 0e6c84e..1af4871 100644 --- a/t/plugin_tests/auth/auth_vpopmail_sql +++ b/t/plugin_tests/auth/auth_vpopmail_sql @@ -6,6 +6,11 @@ use warnings; sub register_tests { my $self = shift; + eval 'use DBI'; + if ( $@ ) { + warn "skipping auth_vpopmail_sql tests, is DBI installed?\n"; + return; + }; $self->register_test("auth_vpopmail_sql", 3); } @@ -15,7 +20,7 @@ sub auth_vpopmail_sql { my $dbh = $self->get_db_handle() or do { foreach ( 0..2 ) { - ok( 1, "auth_vpopmail_sql, skipped (no DB)" ); + ok( 1, "skipped (no DB)" ); }; return; }; @@ -24,11 +29,11 @@ sub auth_vpopmail_sql { my $vuser = $self->get_vpopmail_user( $dbh, 'postmaster@example.com' ); if ( ! $vuser || ! $vuser->{pw_passwd} ) { foreach ( 0..1 ) { - ok( 1, "auth_vpopmail_sql, no example.com domain" ); + ok( 1, "no example.com domain" ); }; return; }; - ok( ref $vuser, "auth_vpopmail_sql, found example.com domain" ); + ok( ref $vuser, "found example.com domain" ); ok( $self->auth_vmysql( $self->qp->transaction, @@ -38,6 +43,6 @@ sub auth_vpopmail_sql { $vuser->{pw_passwd}, $ticket, ), - "auth_vpopmail_sql, postmaster" + "postmaster" ); }