Skip to content

Commit

Permalink
Merge pull request #229 from jaredj/more-test
Browse files Browse the repository at this point in the history
A little more testing for run_continuation()
  • Loading branch information
msimerson committed Feb 11, 2015
2 parents 37c04cf + d2079c4 commit 1ef0aa1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion t/qpsmtpd.t
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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 );
Expand All @@ -197,6 +204,7 @@ sub __run_continuation {
"run_continuation() logging on $t->{descr}" );
}
$smtpd->unfake_hook('helo');
$smtpd->unfake_config();
}
}

Expand Down

0 comments on commit 1ef0aa1

Please sign in to comment.