blob: b27e994891a4753430a2713956b14cae4c1c51aa (
plain)
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
28
29
30
31
32
33
34
35
36
37
|
#!/usr/bin/env perl
use Test::More tests => 1;
use IO::File;
use strict;
use warnings;
my $spamcat = 'bin/spamcat';
my $conffile = 't/fixtures/sample.conf';
# Add testlib which has createdb and possibly population of said db.
my @dumpconfig = `$spamcat -c t/fixtures/sample.conf dumpconfig`;
my %got = parse_configdump(@dumpconfig);
my %expected = (DBPATH => '/tmp/spamcat.sqlite3',
DEFAULT_COUNT => 10,
DELIVER => 't/delivert',
DOMAINS => "spamcat.example.com, spamcat2.example.com, spamcat3");
is_deeply(\%got, \%expected);
# TODO: Test for proper exit codes.
#my $fh = IO::File->new("|$spamcat -c $conffile") ||
# die "Couldn't open pipe to $spamcat: $!\n";
#$fh->close;
sub parse_configdump {
my %rc;
while (my $line = shift) {
$line =~ /(.*) = (.*)/;
$rc{$1} = $2;
}
%rc;
}
|