---
t/plugin_tests/check_badmailfrom | 33 ++++++++++++++++-----------------
t/plugin_tests/check_badmailfromto | 8 ++++----
t/plugin_tests/ident/p0f | 15 +++++++--------
t/plugin_tests/rcpt_ok | 22 +++++++++++-----------
t/plugin_tests/sender_permitted_from | 10 +++++-----
t/plugin_tests/spamassassin | 34 +++++++++++++++++-----------------
6 files changed, 60 insertions(+), 62 deletions(-)
diff --git a/t/plugin_tests/check_badmailfrom b/t/plugin_tests/check_badmailfrom
index 60610fe..ac6227e 100644
--- a/t/plugin_tests/check_badmailfrom
+++ b/t/plugin_tests/check_badmailfrom
@@ -21,23 +21,23 @@ sub test_badmailfrom_is_immune {
my $test_email = '[email protected]';
my $address = Qpsmtpd::Address->new( "<$test_email>" );
$transaction->sender($address);
- ok( $self->is_immune( $transaction->sender, [] ), "is_immune, empty list");
+ ok( $self->is_immune( $transaction->sender, [] ), "empty list");
$address = Qpsmtpd::Address->new( '<>' );
$transaction->sender($address);
- ok( $self->is_immune( $transaction->sender, ['[email protected]'] ),
"is_immune, null sender");
+ ok( $self->is_immune( $transaction->sender, ['[email protected]'] ), "null
sender");
$address = Qpsmtpd::Address->new( '<matt@>' );
$transaction->sender($address);
- ok( $self->is_immune( $transaction->sender, ['[email protected]'] ),
"is_immune, missing host");
+ ok( $self->is_immune( $transaction->sender, ['[email protected]'] ),
"missing host");
$address = Qpsmtpd::Address->new( '<@example.com>' );
$transaction->sender($address);
- ok( $self->is_immune( $transaction->sender, ['[email protected]'] ),
"is_immune, missing user");
+ ok( $self->is_immune( $transaction->sender, ['[email protected]'] ),
"missing user");
$address = Qpsmtpd::Address->new( '<[email protected]>' );
$transaction->sender($address);
- ok( ! $self->is_immune( $transaction->sender, ['[email protected]'] ),
"is_immune, false");
+ ok( ! $self->is_immune( $transaction->sender, ['[email protected]'] ),
"false");
};
sub test_badmailfrom_hook_mail {
@@ -52,16 +52,15 @@ sub test_badmailfrom_hook_mail {
$self->{_badmailfrom_config} = ['[email protected]','[email protected]'];
$transaction->notes('badmailfrom', '');
my ($r) = $self->hook_mail( $transaction, $address );
- ok( $r == 909, "badmailfrom hook_mail");
+ ok( $r == 909, "hook_mail");
ok( $transaction->notes('badmailfrom') eq 'Your envelope sender is in my
badmailfrom list',
- "badmailfrom hook_mail: default reason");
+ "default reason");
$self->{_badmailfrom_config} = ['[email protected]','[email protected] Yer a
spammin bastert'];
$transaction->notes('badmailfrom', '');
($r) = $self->hook_mail( $transaction, $address );
- ok( $r == 909, "badmailfrom hook_mail");
- ok( $transaction->notes('badmailfrom') eq 'Yer a spammin bastert',
- "badmailfrom hook_mail: custom reason");
+ ok( $r == 909, "hook_mail");
+ ok( $transaction->notes('badmailfrom') eq 'Yer a spammin bastert', "custom
reason");
};
@@ -84,24 +83,24 @@ sub test_badmailfrom_match {
# is_match receives ( $from, $bad, $host )
my $r = $self->is_match( '[email protected]', '[email protected]', 'test.net' );
- ok($r, "check_badmailfrom match");
+ ok($r, "match");
ok( ! $self->is_match( '[email protected]', '[email protected]', 'tnpi.net' ),
- "check_badmailfrom non-match");
+ "non-match");
ok( $self->is_match( '[email protected]', '@test.net', 'test.net' ),
- "check_badmailfrom match host");
+ "match host");
ok( ! $self->is_match( '[email protected]', '@test.not', 'test.net' ),
- "check_badmailfrom non-match host");
+ "non-match host");
ok( ! $self->is_match( '[email protected]', '@test.net', 'test.not' ),
- "check_badmailfrom non-match host");
+ "non-match host");
ok( $self->is_match( '[email protected]', 'test.net$', 'tnpi.net' ),
- "check_badmailfrom pattern match");
+ "pattern match");
ok( ! $self->is_match( '[email protected]', 'test.not$', 'tnpi.net' ),
- "check_badmailfrom pattern non-match");
+ "pattern non-match");
};
diff --git a/t/plugin_tests/check_badmailfromto
b/t/plugin_tests/check_badmailfromto
index 73d9bb9..e71abd2 100644
--- a/t/plugin_tests/check_badmailfromto
+++ b/t/plugin_tests/check_badmailfromto
@@ -20,17 +20,17 @@ sub test_badmailfromto_is_sender_immune {
ok( $self->is_sender_immune( $transaction->sender, [] ), "is_immune, empty
list");
$transaction->sender( Qpsmtpd::Address->new( '<>' ) );
- ok( $self->is_sender_immune( $transaction->sender, ['[email protected]'] ),
"is_immune, null sender");
+ ok( $self->is_sender_immune( $transaction->sender, ['[email protected]'] ),
"null sender");
my $address = Qpsmtpd::Address->new( '<matt@>' );
$transaction->sender($address);
- ok( $self->is_sender_immune( $transaction->sender, ['[email protected]'] ),
"is_immune, missing host");
+ ok( $self->is_sender_immune( $transaction->sender, ['[email protected]'] ),
"missing host");
$address = Qpsmtpd::Address->new( '<@example.com>' );
$transaction->sender($address);
- ok( $self->is_sender_immune( $transaction->sender, ['[email protected]'] ),
"is_immune, missing user");
+ ok( $self->is_sender_immune( $transaction->sender, ['[email protected]'] ),
"missing user");
$transaction->sender( Qpsmtpd::Address->new( '<[email protected]>' ) );
- ok( ! $self->is_sender_immune( $transaction->sender, ['[email protected]']
), "is_immune, false");
+ ok( ! $self->is_sender_immune( $transaction->sender, ['[email protected]']
), "false");
};
diff --git a/t/plugin_tests/ident/p0f b/t/plugin_tests/ident/p0f
index cf743c9..8643232 100644
--- a/t/plugin_tests/ident/p0f
+++ b/t/plugin_tests/ident/p0f
@@ -12,7 +12,7 @@ sub register_tests {
$self->register_test('test_get_v3_query', 1);
$self->register_test('test_store_v2_results', 2);
$self->register_test('test_store_v3_results', 2);
-}
+};
sub test_query_p0f_v2 {
#TODO
@@ -43,7 +43,7 @@ sub test_get_v2_query {
$self->qp->connection->remote_port(2500);
my $r = $self->get_v2_query();
- ok( $r, 'get_v2_query' );
+ ok( $r, 'r +' );
#use Data::Dumper; warn Data::Dumper::Dumper( $r );
};
@@ -54,8 +54,7 @@ sub test_get_v3_query {
$self->qp->connection->remote_ip($remote);
my $r = $self->get_v3_query();
- ok( $r, 'get_v3_query' );
- #use Data::Dumper; warn Data::Dumper::Dumper( $r );
+ ok( $r, 'any +' );
};
sub test_store_v2_results {
@@ -67,8 +66,8 @@ sub test_store_v2_results {
my $r = $self->store_v2_results( $response );
- ok( $r, "query_p0f_v2 result") or return;
- ok( $r->{genre} =~ /windows/i, "store_v2_results, genre" );
+ ok( $r, "r: +") or return;
+ ok( $r->{genre} =~ /windows/i, "genre +" );
#use Data::Dumper; warn Data::Dumper::Dumper( $r );
};
@@ -80,8 +79,8 @@ sub test_store_v3_results {
'Windows', '7 or 8', '', '', 'Ethernet or modem', '', '');
my $r = $self->store_v3_results( $response );
- ok( $r, "query_p0f_v3 result");
- ok( $r->{genre} =~ /windows/i, "store_v3_results, genre" );
+ ok( $r, "result");
+ ok( $r->{genre} =~ /windows/i, "genre" );
};
diff --git a/t/plugin_tests/rcpt_ok b/t/plugin_tests/rcpt_ok
index a7fad27..67c47d5 100644
--- a/t/plugin_tests/rcpt_ok
+++ b/t/plugin_tests/rcpt_ok
@@ -57,13 +57,13 @@ sub test_is_in_morercpthosts {
my $ref = $self->qp->config('morercpthosts', 'map');
my ($domain) = keys %$ref;
if ( $domain ) {
- ok( $self->is_in_morercpthosts( $domain ), "is_in_morercpthosts,
$domain");
+ ok( $self->is_in_morercpthosts( $domain ), "$domain");
}
else {
- ok(1, "is_in_morercpthosts (skip, no entries)" );
+ ok(1, "skip, (no entries)" );
};
- ok( ! $self->is_in_morercpthosts( 'example.com' ), "is_in_morercpthosts
-");
+ ok( ! $self->is_in_morercpthosts( 'example.com' ), "-");
};
sub test_get_rcpt_host {
@@ -71,34 +71,34 @@ sub test_get_rcpt_host {
my $address = Qpsmtpd::Address->parse('<[email protected]>');
cmp_ok( $self->get_rcpt_host( $address ), 'eq', 'example.com',
- "get_rcpt_host, +" );
+ "+" );
$address = Qpsmtpd::Address->parse('<[email protected]>');
cmp_ok( $self->get_rcpt_host( $address ), 'eq', 'example.com',
- "get_rcpt_host, +" );
+ "+" );
$address = Qpsmtpd::Address->parse('<[email protected]>');
cmp_ok( $self->get_rcpt_host( $address ), 'eq', 'example.com',
- "get_rcpt_host, +" );
+ "+" );
$address = Qpsmtpd::Address->parse('<postmaster>');
my $local_hostname = $self->get_rcpt_host( $address );
if ( $local_hostname eq 'some.host.example.org' ) {
cmp_ok( $self->get_rcpt_host( $address ), 'eq',
'some.host.example.org',
- "get_rcpt_host, special postmaster +" );
+ "special postmaster +" );
}
else {
- ok( 1, "get_rcpt_host, special postmaster + ($local_hostname)" );
+ ok( 1, "special postmaster + ($local_hostname)" );
}
# I think this is a bug. Qpsmtpd::Address fails to parse <abuse>
$address = Qpsmtpd::Address->parse('<abuse>');
- ok( ! $self->get_rcpt_host( $address ), "get_rcpt_host, missing host" );
+ ok( ! $self->get_rcpt_host( $address ), "missing host" );
$address = Qpsmtpd::Address->parse('<>');
- ok( ! $self->get_rcpt_host( $address ), "get_rcpt_host, null recipient" );
+ ok( ! $self->get_rcpt_host( $address ), "null recipient" );
$address = Qpsmtpd::Address->parse('<@example.com>');
- ok( ! $self->get_rcpt_host( $address ), "get_rcpt_host, missing user" );
+ ok( ! $self->get_rcpt_host( $address ), "missing user" );
};
diff --git a/t/plugin_tests/sender_permitted_from
b/t/plugin_tests/sender_permitted_from
index a69f5b0..0459e3c 100644
--- a/t/plugin_tests/sender_permitted_from
+++ b/t/plugin_tests/sender_permitted_from
@@ -22,16 +22,16 @@ sub test_is_relayclient {
my $transaction = $self->qp->transaction;
ok( ! $self->is_relayclient( $transaction ),
- "sender_permitted_from, is_relayclient -");
+ "is_relayclient -");
$self->qp->connection->relay_client(1);
ok( $self->is_relayclient( $transaction ),
- "sender_permitted_from, is_relayclient +");
+ "is_relayclient +");
$self->qp->connection->relay_client(0);
$self->qp->connection->remote_ip('192.168.7.5');
my $client_ip = $self->qp->connection->remote_ip;
- ok( $client_ip, "sender_permitted_from, relayclients ($client_ip)");
+ ok( $client_ip, "relayclients ($client_ip)");
};
sub test_is_special_recipient {
@@ -40,11 +40,11 @@ sub test_is_special_recipient {
my $transaction = $self->qp->transaction;
my $address = Qpsmtpd::Address->new('[email protected]');
- ok( ! $self->is_special_recipient( $address ), "is_special_recipient -");
+ ok( ! $self->is_special_recipient( $address ), "not special");
foreach my $user ( qw/ postmaster abuse mailer-daemon root / ) {
$address = Qpsmtpd::Address->new("$user\@example.com");
- ok( $self->is_special_recipient( $address ), "is_special_recipient
($user)");
+ ok( $self->is_special_recipient( $address ), "special: $user");
};
};
diff --git a/t/plugin_tests/spamassassin b/t/plugin_tests/spamassassin
index 67018b4..e9cd23c 100644
--- a/t/plugin_tests/spamassassin
+++ b/t/plugin_tests/spamassassin
@@ -43,34 +43,34 @@ sub test_connect_to_spamd {
$self->{_args}{spamd_socket} = '/var/run/spamd/spamd.socket';
my $SPAMD = $self->connect_to_spamd();
if ( $SPAMD ) {
- ok( $SPAMD, "connect_to_spamd, socket");
+ ok( $SPAMD, "socket");
$self->print_to_spamd( $SPAMD, $message, $length, $username );
shutdown($SPAMD, 1); # close our side of the socket (tell spamd we're
done)
my $headers = $self->parse_spamd_response( $SPAMD );
#warn Data::Dumper::Dumper($headers);
- ok( $headers, "connect_to_spamd, socket response\n");
+ ok( $headers, "socket response\n");
}
else {
- ok( 1 == 1, "connect_to_spamd, socket connect FAILED");
- ok( 1 == 1, "connect_to_spamd, socket response FAILED");
+ ok( 1 == 1, "socket connect FAILED");
+ ok( 1 == 1, "socket response FAILED");
};
# Try a TCP/IP connection
$self->{_args}{spamd_socket} = '127.0.0.1:783';
$SPAMD = $self->connect_to_spamd();
if ( $SPAMD ) {
- ok( $SPAMD, "connect_to_spamd, tcp/ip");
+ ok( $SPAMD, "tcp/ip");
#warn Data::Dumper::Dumper($SPAMD);
$self->print_to_spamd( $SPAMD, $message, $length, $username );
shutdown($SPAMD, 1); # close our side of the socket (tell spamd we're
done)
my $headers = $self->parse_spamd_response( $SPAMD );
#warn Data::Dumper::Dumper($headers);
- ok( $headers, "connect_to_spamd, tcp/ip response\n");
+ ok( $headers, "tcp/ip response\n");
}
else {
- ok( 1 == 1, "connect_to_spamd, tcp/ip connect FAILED");
- ok( 1 == 1, "connect_to_spamd, tcp/ip response FAILED");
+ ok( 1 == 1, "tcp/ip connect FAILED");
+ ok( 1 == 1, "tcp/ip response FAILED");
};
};
@@ -84,13 +84,13 @@ sub test_check_spam_reject {
$self->{_args}{reject} = 12;
$transaction->notes('spamassassin', { is_spam => 'Yes', score => 10 } );
my $r = $self->check_spam_reject($transaction);
- cmp_ok( DECLINED, '==', $r, "check_spam_reject, $r");
+ cmp_ok( DECLINED, '==', $r, "r: $r");
# message scored a 15, should fail
$self->{_args}{reject} = 12;
$transaction->notes('spamassassin', { is_spam => 'Yes', score => 15 } );
($r) = $self->check_spam_reject($transaction);
- cmp_ok( DENY, '==', $r, "check_spam_reject, $r");
+ cmp_ok( DENY, '==', $r, "r: $r");
};
sub test_check_spam_munge_subject {
@@ -105,7 +105,7 @@ sub test_check_spam_munge_subject {
$transaction->header->add('Subject', $subject);
$self->check_spam_munge_subject($transaction);
my $r = $transaction->header->get('Subject'); chomp $r;
- cmp_ok($r, 'eq', "*** SPAM *** $subject", "check_spam_munge_subject +");
+ cmp_ok($r, 'eq', "*** SPAM *** $subject", "+");
$transaction->header->delete('Subject'); # cleanup
$self->{_args}{munge_subject_threshold} = 5;
@@ -113,21 +113,21 @@ sub test_check_spam_munge_subject {
$transaction->header->add('Subject', $subject);
$self->check_spam_munge_subject($transaction);
$r = $transaction->header->get('Subject'); chomp $r;
- cmp_ok($r, 'eq', $subject, "check_spam_munge_subject -");
+ cmp_ok($r, 'eq', $subject, "-");
$transaction->header->delete('Subject'); # cleanup
$transaction->notes('spamassassin', { score => 3, required => 4 } );
$transaction->header->add('Subject', $subject);
$self->check_spam_munge_subject($transaction);
$r = $transaction->header->get('Subject'); chomp $r;
- cmp_ok($r, 'eq', $subject, "check_spam_munge_subject -");
+ cmp_ok($r, 'eq', $subject, "-");
$transaction->header->delete('Subject'); # cleanup
$transaction->notes('spamassassin', { score => 5, required => 4 } );
$transaction->header->add('Subject', $subject);
$self->check_spam_munge_subject($transaction);
$r = $transaction->header->get('Subject'); chomp $r;
- cmp_ok($r, 'eq', "*** SPAM *** $subject", "check_spam_munge_subject +");
+ cmp_ok($r, 'eq', "*** SPAM *** $subject", "+");
};
sub test_get_spam_results {
@@ -145,13 +145,13 @@ sub test_get_spam_results {
$r_ref->{hits} = delete $r_ref->{score}; # SA v2 compat
};
my $r2 = _reassemble_header($r_ref);
- cmp_ok( $h, 'eq', $r2, "get_spam_results ($h)" );
+ cmp_ok( $h, 'eq', $r2, $h );
# this time it should be cached
$r_ref = $self->get_spam_results($transaction);
next if $h =~ /hits=/; # caching is broken for SA v2 headers
$r2 = _reassemble_header($r_ref);
- cmp_ok( $h, 'eq', $r2, "get_spam_results ($h)" );
+ cmp_ok( $h, 'eq', $r2, $h );
};
};
@@ -165,7 +165,7 @@ sub test_parse_spam_header {
$r_ref->{hits} = delete $r_ref->{score}; # SA v2 compat
};
my $r2 = _reassemble_header($r_ref);
- cmp_ok( $h, 'eq', $r2, "parse_spam_header ($h)" );
+ cmp_ok( $h, 'eq', $r2, $h );
};
};
--
1.7.9.6