diff --git a/t/plugin_tests/check_badmailfrom b/t/plugin_tests/check_badmailfrom index a4a45b3..e80e0fb 100644 --- a/t/plugin_tests/check_badmailfrom +++ b/t/plugin_tests/check_badmailfrom @@ -11,7 +11,6 @@ sub register_tests { $self->register_test("test_badmailfrom_is_immune_sender", 5); $self->register_test("test_badmailfrom_match", 7); $self->register_test("test_badmailfrom_hook_mail", 4); - $self->register_test("test_badmailfrom_rcpt_handler", 2); } sub test_badmailfrom_is_immune_sender { @@ -50,31 +49,18 @@ sub test_badmailfrom_hook_mail { $transaction->sender($address); $self->{_badmailfrom_config} = ['matt@test.net','matt@test.com']; - $self->connection->notes('badmailfrom', ''); - my ($r) = $self->hook_mail( $transaction, $address ); - ok( $r == 909, "badmailfrom hook_mail"); - cmp_ok( $self->connection->notes('naughty'), 'eq', 'Your envelope sender is in my badmailfrom list', "default reason"); + $transaction->notes('badmailfrom', ''); + my ($r, $err) = $self->hook_mail( $transaction, $address ); + cmp_ok( $r, '==', 901, "hook_mail rc"); + 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->connection->notes('badmailfrom', ''); - ($r) = $self->hook_mail( $transaction, $address ); - ok( $r == 909, "badmailfrom hook_mail"); - cmp_ok( $self->connection->notes('naughty'), 'eq', 'Yer a spammin bastert', "custom reason"); + $transaction->notes('badmailfrom', ''); + ($r, $err) = $self->hook_mail( $transaction, $address ); + cmp_ok( $r, '==', 901, "hook_mail rc"); + 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 { my $self = shift; 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, ['bad@example.com'] ), "is_immune, null sender"); + ok( $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "null sender"); my $address = Qpsmtpd::Address->new( '' ); $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>' ); $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( '' ) ); - ok( ! $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "is_immune, false"); + ok( ! $self->is_sender_immune( $transaction->sender, ['bad@example.com'] ), "false"); };