qpsmtpd/t/plugin_tests/auth/auth_flat_file
Matt Sergeant ef7d885929 Allow plugin tests to be in subdir (as with plugins).
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@737 958fd67b-6ff1-0310-b445-bb7760255be9
2007-05-17 22:02:32 +00:00

28 lines
686 B
Perl

# -*-perl-*- [emacs]
sub register_tests {
my $self = shift;
$self->register_test("test_authsql", 3);
}
my @u_list = qw ( good bad none );
my %u_data = (
good => [ 'good@example.com', OK, 'good_pass' ],
bad => [ 'bad@example.com', DENY, 'not_bad_pass' ],
none => [ 'none@example.com', DECLINED, '' ],
);
sub test_authsql {
my $self = shift;
my ($tran, $ret, $note, $u, $r, $p, $a );
$tran = $self->qp->transaction;
for $u ( @u_list ) {
( $a,$r,$p ) = @{$u_data{$u}};
($ret, $note) = $self->authsql($tran,'CRAMMD5',$a,$p);
defined $note or $note='No-Message';
is ($ret, $r, $note);
# - for debugging.
# warn "$note\n";
}
}