From d3787044fdc2d69a4b8e221abb2e2dbf5b5355ce Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 25 Jun 2012 03:38:17 -0400 Subject: [PATCH] resolveable_fromhost: updated tests --- t/plugin_tests/resolvable_fromhost | 65 ------------------------------ 1 file changed, 65 deletions(-) diff --git a/t/plugin_tests/resolvable_fromhost b/t/plugin_tests/resolvable_fromhost index 865e993..ebf4527 100644 --- a/t/plugin_tests/resolvable_fromhost +++ b/t/plugin_tests/resolvable_fromhost @@ -17,13 +17,11 @@ sub register_tests { my %args = ( ); $self->register( $self->qp, reject => 0 ); - $self->register_test('test_is_immune', 3); $self->register_test('test_populate_invalid_networks', 2); $self->register_test('test_mx_address_resolves', 2); $self->register_test('test_get_host_records', 2); $self->register_test('test_get_and_validate_mx', 2); $self->register_test('test_check_dns', 2); - $self->register_test('test_hook_rcpt', 10); $self->register_test('test_hook_mail', 4); } @@ -51,48 +49,6 @@ sub test_hook_mail { ok( $r == DENY, "($r)"); }; -sub test_hook_rcpt { - my $self = shift; - - my $transaction = $self->qp->transaction; - my $recipient = 'foo@example.com'; - - $transaction->notes('resolvable_fromhost', 'a'); - ok( DECLINED == $self->hook_rcpt( $transaction, $recipient ) ); - - $transaction->notes('resolvable_fromhost', 'mx'); - ok( DECLINED == $self->hook_rcpt( $transaction, $recipient ) ); - - $transaction->notes('resolvable_fromhost', 'ip'); - ok( DECLINED == $self->hook_rcpt( $transaction, $recipient ) ); - - $transaction->notes('resolvable_fromhost', 'whitelist'); - ok( DECLINED == $self->hook_rcpt( $transaction, $recipient ) ); - - $transaction->notes('resolvable_fromhost', 'null'); - ok( DECLINED == $self->hook_rcpt( $transaction, $recipient ) ); - - $transaction->notes('resolvable_fromhost', 'config'); - ok( DECLINED == $self->hook_rcpt( $transaction, $recipient ) ); - - $transaction->notes('resolvable_fromhost', 'oops!'); - ok( DECLINED == $self->hook_rcpt( $transaction, $recipient ) ); - - $transaction->notes('resolvable_fromhost', 'oops!'); - ok( DECLINED == $self->hook_rcpt( $transaction, $recipient ) ); - - $transaction->notes('resolvable_fromhost', 'oops!'); - $self->{_args}{reject} = 1; - $self->{_args}{reject_type} = 'soft'; - my ($r) = $self->hook_rcpt( $transaction, $recipient ); - ok( DENYSOFT == $r, "($r)"); - - $transaction->notes('resolvable_fromhost', 'failed again'); - $self->{_args}{reject_type} = 'hard'; - ($r) = $self->hook_rcpt( $transaction, $recipient ); - ok( DENY == $r, "($r)"); -}; - sub test_check_dns { my $self = shift; @@ -142,24 +98,3 @@ sub test_populate_invalid_networks { $self->{invalid} = (); }; -sub test_is_immune { - my $self = shift; - - my $transaction = $self->qp->transaction; - - # null sender should be immune - $transaction->sender('<>'); - ok( $self->is_immune( $transaction->sender, $transaction ) ); - - # whitelisted host should be immune - my $connection = $self->qp->connection->notes('whitelisthost', 1); - ok( $self->is_immune( $transaction->sender, $transaction ) ); - $self->qp->connection->notes('whitelisthost', undef); - - # reject is not defined, so email should not be immune - my $address = Qpsmtpd::Address->new( "<$test_email>" ); - $transaction->sender($address); - ok( ! $self->is_immune( $transaction->sender, $transaction ) ); -}; - -