File: config.t

package info (click to toggle)
qpsmtpd 0.84-5
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,308 kB
  • ctags: 407
  • sloc: perl: 8,012; sh: 382; makefile: 56
file content (27 lines) | stat: -rw-r--r-- 731 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl -w
use Test::More qw(no_plan);
use File::Path;
use strict;
use lib 't';
use_ok('Test::Qpsmtpd');

BEGIN { # need this to happen before anything else
    my $cwd = `pwd`;
    chomp($cwd);
    open my $me_config, '>', "./config.sample/me";
    print $me_config "some.host.example.org";
    close $me_config;
}

ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");

is($smtpd->config('me'), 'some.host.example.org', 'config("me")');

# test for ignoring leading/trailing whitespace (relayclients has a
# line with both)
my $relayclients = join ",", sort $smtpd->config('relayclients');
is($relayclients, '127.0.0.1,192.168.', 'config("relayclients") are trimmed');

unlink "./config.sample/me";