summaryrefslogtreecommitdiff
path: root/t/05-gray-empty.t
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2007-12-27 14:36:45 +0000
committerdakkar <dakkar@luxion>2007-12-27 14:36:45 +0000
commitf67531bad2b0aaebfea7ec63922290f28e86d6ab (patch)
treec5650db6cef8af570767ccb00bfacdf422a49632 /t/05-gray-empty.t
parent r3302@rfc-1918: dakkar | 2007-12-27 13:18:56 +0100 (diff)
downloadGraylister-f67531bad2b0aaebfea7ec63922290f28e86d6ab.tar.gz
Graylister-f67531bad2b0aaebfea7ec63922290f28e86d6ab.tar.bz2
Graylister-f67531bad2b0aaebfea7ec63922290f28e86d6ab.zip
r3304@rfc-1918: dakkar | 2007-12-27 13:19:58 +0100
prepraering fro branching
Diffstat (limited to 't/05-gray-empty.t')
-rw-r--r--t/05-gray-empty.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/05-gray-empty.t b/t/05-gray-empty.t
new file mode 100644
index 0000000..2fe3b0d
--- /dev/null
+++ b/t/05-gray-empty.t
@@ -0,0 +1,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');