qpsmtpd/t/plugin_tests/auth/auth_vpopmail_sql
Matt Simerson a5420149bd remove test counters from plugin tests
replace with done_testing(), which provides the same "make sure to kvetch if tests fail to run" without requiring humans to do the bookkeeping.
2014-09-17 00:11:32 -07:00

49 lines
1.1 KiB
Perl

#!perl -w
use strict;
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");
}
sub auth_vpopmail_sql {
my $self = shift;
my ( $transaction, $method, $user, $passClear, $passHash, $ticket ) = @_;
my $dbh = $self->get_db_handle() or do {
foreach ( 0..2 ) {
ok( 1, "skipped (no DB)" );
};
return;
};
ok( $dbh, "auth_vpopmail_sql, got a dbh" );
my $vuser = $self->get_vpopmail_user( $dbh, 'postmaster@example.com' );
if ( ! $vuser || ! $vuser->{pw_passwd} ) {
foreach ( 0..1 ) {
ok( 1, "no example.com domain" );
};
return;
};
ok( ref $vuser, "found example.com domain" );
ok( $self->auth_vmysql(
$self->qp->transaction,
'PLAIN',
'postmaster@example.com',
$vuser->{pw_clear_passwd},
$vuser->{pw_passwd},
$ticket,
),
"postmaster"
);
}