# Bounce verp tests sub register_tests { my $self = shift; $self->register_test(test_skip_verp => 8); $self->register_test(test_is_bounce => 4); $self->register_test(test_do_verp => 1); $self->register_test(test_check_verp => 1); } sub test_skip_verp { my $self = shift; # poison the cache $self->qp->{_config_cache}->{'bounce_verp.skip'} = [ 'example.com', 'qpsmtpd@perl.org', ]; # check the cache poison my @skip = $self->qp->config('bounce_verp.skip'); ok(@skip == 2, "skip contains right number of elements"); for (qw(test@example.com x@example.com qpsmtpd@perl.org qpsmtpd-foo@perl.org x@eXample.com)) { ok($self->skip_verp($_), "Skip $_"); } for (qw(test@example.org p5p@perl.org)) { ok(!$self->skip_verp($_), "Skip $_"); } } sub test_is_bounce { my $self = shift; my $tran = $self->transaction(); # check null sender $tran->sender(Qpsmtpd::Address->new('<>')); ok($self->is_bounce($tran), "Check null sender is_bounce"); # check postmaster mail $tran->sender(Qpsmtpd::Address->new('')); ok($self->is_bounce($tran), "Check postmaster is_bounce"); # check mailer-daemon mail $tran->sender(Qpsmtpd::Address->new('')); ok($self->is_bounce($tran), "Check mailer-daemon is_bounce"); $tran->sender(Qpsmtpd::Address->new('')); ok($self->is_bounce($tran), "Check mailer_daemon is_bounce"); } sub test_do_verp { ok(1); } sub test_check_verp { ok(1); }