From d2079c455a84a478ceb5142e2d3f8e96442808ec Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Wed, 11 Feb 2015 15:07:10 -0600 Subject: [PATCH] A little more testing for run_continuation() --- t/qpsmtpd.t | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/t/qpsmtpd.t b/t/qpsmtpd.t index d422dd7..0db5ce5 100644 --- a/t/qpsmtpd.t +++ b/t/qpsmtpd.t @@ -148,7 +148,6 @@ sub __run_continuation { disconnected => 0, descr => 'DECLINED -> DENY', }, - # TODO: ignore invalid return codes rather than treating them like OK { hooks => [ [123456,undef], [DENY, 'goaway'] ], expected_response => '550/goaway', @@ -170,8 +169,16 @@ sub __run_continuation { logged => 'LOGERROR:Plugin ___FakeHook___, hook helo returned undef!', descr => 'undef -> DENY', }, + { + hooks => [ [OK, 'bemyguest'], [DENY, 'seeya'] ], + expected_response => '250/fqdn Hi test@localhost [127.0.0.1];' + . ' I am so happy to meet you.', + disconnected => 0, + descr => 'OK -> DENY', + }, ); for my $t (@test_data) { + $smtpd->fake_config( me => 'fqdn' ); for my $h ( reverse @{ $t->{hooks} } ) { my $sub = ( ref $h eq 'ARRAY' ? sub { return @$h } : $h ); $smtpd->fake_hook( 'helo', $sub ); @@ -197,6 +204,7 @@ sub __run_continuation { "run_continuation() logging on $t->{descr}" ); } $smtpd->unfake_hook('helo'); + $smtpd->unfake_config(); } }