| 1 |
#!/usr/bin/perl -w |
| 2 |
use Test::More qw(no_plan); |
| 3 |
use File::Path; |
| 4 |
use strict; |
| 5 |
use lib 't'; |
| 6 |
use_ok('Test::Qpsmtpd'); |
| 7 |
|
| 8 |
my @mes; |
| 9 |
|
| 10 |
BEGIN { # need this to happen before anything else |
| 11 |
my $cwd = `pwd`; |
| 12 |
chomp($cwd); |
| 13 |
@mes = qw{ ./config.sample/me ./t/config/me }; |
| 14 |
foreach my $f (@mes) { |
| 15 |
open my $me_config, '>', $f; |
| 16 |
print $me_config "some.host.example.org"; |
| 17 |
close $me_config; |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection"); |
| 22 |
|
| 23 |
is($smtpd->config('me'), 'some.host.example.org', 'config("me")'); |
| 24 |
|
| 25 |
# test for ignoring leading/trailing whitespace (relayclients has a |
| 26 |
# line with both) |
| 27 |
my $relayclients = join ",", sort $smtpd->config('relayclients'); |
| 28 |
is( |
| 29 |
$relayclients, |
| 30 |
'127.0.0.1,192.0.,2001:0DB8,2001:0DB8:0000:0000:0000:0000:0000:0001,2001:DB8::1,2001:DB8::1/32', |
| 31 |
'config("relayclients") are trimmed' |
| 32 |
); |
| 33 |
|
| 34 |
foreach my $f (@mes) { |
| 35 |
unlink $f if -f $f; |
| 36 |
} |
| 37 |
|