2008-02-14 19:56:33 +01:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
use Test::More qw(no_plan);
|
|
|
|
use File::Path;
|
|
|
|
use strict;
|
|
|
|
use lib 't';
|
|
|
|
use_ok('Test::Qpsmtpd');
|
|
|
|
|
2012-06-03 04:56:05 +02:00
|
|
|
my @mes;
|
|
|
|
|
2008-02-14 19:56:33 +01:00
|
|
|
BEGIN { # need this to happen before anything else
|
|
|
|
my $cwd = `pwd`;
|
|
|
|
chomp($cwd);
|
2012-06-03 04:56:05 +02:00
|
|
|
@mes = qw{ ./config.sample/me ./t/config/me };
|
|
|
|
foreach my $f ( @mes ) {
|
|
|
|
open my $me_config, '>', $f;
|
|
|
|
print $me_config "some.host.example.org";
|
|
|
|
close $me_config;
|
|
|
|
};
|
2008-02-14 19:56:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");
|
|
|
|
|
|
|
|
is($smtpd->config('me'), 'some.host.example.org', 'config("me")');
|
|
|
|
|
2009-01-02 21:41:00 +01:00
|
|
|
# test for ignoring leading/trailing whitespace (relayclients has a
|
|
|
|
# line with both)
|
|
|
|
my $relayclients = join ",", sort $smtpd->config('relayclients');
|
2012-11-14 23:57:56 +01:00
|
|
|
is($relayclients,
|
2012-11-15 05:21:20 +01:00
|
|
|
'127.0.0.1,192.0.,2001:0DB8:0000:0000:0000:0000:0000:0001,2001:DB8::1/32,2001:DB8,2001:DB8::1',
|
2012-11-14 23:57:56 +01:00
|
|
|
'config("relayclients") are trimmed');
|
2009-01-02 21:41:00 +01:00
|
|
|
|
2012-06-03 04:56:05 +02:00
|
|
|
foreach my $f ( @mes ) {
|
|
|
|
unlink $f if -f $f;
|
|
|
|
};
|
2008-02-14 19:56:33 +01:00
|
|
|
|
|
|
|
|