summaryrefslogtreecommitdiff
path: root/t/05-gray-empty.t
blob: 2fe3b0db4776184f3f7e941c1f70bbb136de5da0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- mode: cperl -*- 
use Test::More tests=>3;
use File::Temp 'tempdir';
use DAKKAR::Graylister;
 
my $dbdir=tempdir(CLEANUP=>1);
 
local $ENV{SMTPMAILFROM}='';
local $ENV{SMTPRCPTTO}='pino';
local $ENV{TCPREMOTEIP}='10.1.2.3';
local $ENV{DAKGL_DBNAME}="$dbdir/gray4.db";
my ($host,$from,$to)=DAKKAR::Graylister::get_from_env();
 
ok(!DAKKAR::Graylister::is_second_attempt($host,$from,$to),'first attempt');
DAKKAR::Graylister::record_first_attempt($host,$from,$to);
ok(DAKKAR::Graylister::is_second_attempt($host,$from,$to),'second attempt');
DAKKAR::Graylister::cleanup_attempt($host,$from,$to);
ok(!DAKKAR::Graylister::is_second_attempt($host,$from,$to),'cleaned attempt');