badmailfrom: removed tests for rcpt_handler
and shorten test response messages in badmailfromto
This commit is contained in:
parent
3b9479a497
commit
eba0a10132
@ -11,7 +11,6 @@ sub register_tests {
|
|||||||
$self->register_test("test_badmailfrom_is_immune_sender", 5);
|
$self->register_test("test_badmailfrom_is_immune_sender", 5);
|
||||||
$self->register_test("test_badmailfrom_match", 7);
|
$self->register_test("test_badmailfrom_match", 7);
|
||||||
$self->register_test("test_badmailfrom_hook_mail", 4);
|
$self->register_test("test_badmailfrom_hook_mail", 4);
|
||||||
$self->register_test("test_badmailfrom_rcpt_handler", 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub test_badmailfrom_is_immune_sender {
|
sub test_badmailfrom_is_immune_sender {
|
||||||
@ -50,31 +49,18 @@ sub test_badmailfrom_hook_mail {
|
|||||||
$transaction->sender($address);
|
$transaction->sender($address);
|
||||||
|
|
||||||
$self->{_badmailfrom_config} = ['matt@test.net','matt@test.com'];
|
$self->{_badmailfrom_config} = ['matt@test.net','matt@test.com'];
|
||||||
$self->connection->notes('badmailfrom', '');
|
$transaction->notes('badmailfrom', '');
|
||||||
my ($r) = $self->hook_mail( $transaction, $address );
|
my ($r, $err) = $self->hook_mail( $transaction, $address );
|
||||||
ok( $r == 909, "badmailfrom hook_mail");
|
cmp_ok( $r, '==', 901, "hook_mail rc");
|
||||||
cmp_ok( $self->connection->notes('naughty'), 'eq', 'Your envelope sender is in my badmailfrom list', "default reason");
|
cmp_ok( $err, 'eq', 'Your envelope sender is in my badmailfrom list', "hook_mail: default reason");
|
||||||
|
|
||||||
$self->{_badmailfrom_config} = ['matt@test.net','matt@test.com Yer a spammin bastert'];
|
$self->{_badmailfrom_config} = ['matt@test.net','matt@test.com Yer a spammin bastert'];
|
||||||
$self->connection->notes('badmailfrom', '');
|
$transaction->notes('badmailfrom', '');
|
||||||
($r) = $self->hook_mail( $transaction, $address );
|
($r, $err) = $self->hook_mail( $transaction, $address );
|
||||||
ok( $r == 909, "badmailfrom hook_mail");
|
cmp_ok( $r, '==', 901, "hook_mail rc");
|
||||||
cmp_ok( $self->connection->notes('naughty'), 'eq', 'Yer a spammin bastert', "custom reason");
|
cmp_ok( $err, 'eq', 'Yer a spammin bastert', "hook_mail: custom reason");
|
||||||
};
|
};
|
||||||
|
|
||||||
sub test_badmailfrom_rcpt_handler {
|
|
||||||
my $self = shift;
|
|
||||||
|
|
||||||
my $transaction = $self->qp->transaction;
|
|
||||||
|
|
||||||
$transaction->notes('badmailfrom', 'Yer a spammin bastart. Be gon wit yuh.' );
|
|
||||||
|
|
||||||
my ($code,$note) = $self->rcpt_handler( $transaction );
|
|
||||||
|
|
||||||
ok( $code == 901, 'badmailfrom hook hit');
|
|
||||||
ok( $note, $note );
|
|
||||||
}
|
|
||||||
|
|
||||||
sub test_badmailfrom_match {
|
sub test_badmailfrom_match {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
|
@ -20,17 +20,17 @@ sub test_badmailfromto_is_sender_immune {
|
|||||||
ok( $self->is_sender_immune( $transaction->sender, [] ), "is_immune, empty list");
|
ok( $self->is_sender_immune( $transaction->sender, [] ), "is_immune, empty list");
|
||||||
|
|
||||||
$transaction->sender( Qpsmtpd::Address->new( '<>' ) );
|
$transaction->sender( Qpsmtpd::Address->new( '<>' ) );
|
||||||
ok( $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "is_immune, null sender");
|
ok( $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "null sender");
|
||||||
|
|
||||||
my $address = Qpsmtpd::Address->new( '<matt@>' );
|
my $address = Qpsmtpd::Address->new( '<matt@>' );
|
||||||
$transaction->sender($address);
|
$transaction->sender($address);
|
||||||
ok( $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "is_immune, missing host");
|
ok( $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "missing host");
|
||||||
|
|
||||||
$address = Qpsmtpd::Address->new( '<@example.com>' );
|
$address = Qpsmtpd::Address->new( '<@example.com>' );
|
||||||
$transaction->sender($address);
|
$transaction->sender($address);
|
||||||
ok( $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "is_immune, missing user");
|
ok( $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "missing user");
|
||||||
|
|
||||||
$transaction->sender( Qpsmtpd::Address->new( '<matt@example.com>' ) );
|
$transaction->sender( Qpsmtpd::Address->new( '<matt@example.com>' ) );
|
||||||
ok( ! $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "is_immune, false");
|
ok( ! $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "false");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user