| 1 |
#!perl -w |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use Qpsmtpd::Constants; |
| 7 |
|
| 8 |
my $r; |
| 9 |
|
| 10 |
sub register_tests { |
| 11 |
my $self = shift; |
| 12 |
|
| 13 |
eval 'use Mail::SPF'; |
| 14 |
return if $@; |
| 15 |
|
| 16 |
$self->register_test('test_is_special_recipient', 5); |
| 17 |
} |
| 18 |
|
| 19 |
sub test_is_special_recipient { |
| 20 |
my $self = shift; |
| 21 |
|
| 22 |
my $transaction = $self->qp->transaction; |
| 23 |
my $address = Qpsmtpd::Address->new('[email protected]'); |
| 24 |
|
| 25 |
ok( ! $self->is_special_recipient( $address ), "not special"); |
| 26 |
|
| 27 |
foreach my $user ( qw/ postmaster abuse mailer-daemon root / ) { |
| 28 |
$address = Qpsmtpd::Address->new("$user\@example.com"); |
| 29 |
ok( $self->is_special_recipient( $address ), "special: $user"); |
| 30 |
}; |
| 31 |
}; |
| 32 |
|