Debian Codegraph @

t/plugin_tests/auth/auth_vpopmail

raw
1 #!perl -w
2
3 use strict;
4 use warnings;
5
6 use Qpsmtpd::Constants;
7
8 sub register_tests {
9 my $self = shift;
10
11 $self->register_test("test_auth_vpopmail", 3);
12 }
13
14 my @u_list = qw ( good bad none );
15 my %u_data = (
16 good => [ '[email protected]', OK, 'Good Strong Passphrase' ],
17 bad => [ '[email protected]', DENY, 'not_bad_pass' ],
18 none => [ '[email protected]', DECLINED, '' ],
19 );
20
21 sub test_auth_vpopmail {
22 my $self = shift;
23
24 if ( ! $self->test_vpopmail_module ) {
25 warn "vpopmail plugin not configured\n";
26 foreach ( 0..2) { ok( 1, "skipped") };
27 return;
28 };
29
30 my ($tran, $ret, $note, $u, $r, $p, $a );
31 $tran = $self->qp->transaction;
32 for $u ( @u_list ) {
33 ( $a,$r,$p ) = @{$u_data{$u}};
34 ($ret, $note) = $self->auth_vpopmail($tran,'CRAMMD5',$a,$p);
35 defined $note or $note='auth_vpopmail: No-Message';
36 is ($ret, $r, $note);
37 }
38 }