diff options
Diffstat (limited to 't/04-gray.t')
-rw-r--r-- | t/04-gray.t | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/t/04-gray.t b/t/04-gray.t new file mode 100644 index 0000000..893c1d1 --- /dev/null +++ b/t/04-gray.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}='gino'; +local $ENV{SMTPRCPTTO}='pino'; +local $ENV{TCPREMOTEIP}='10.1.2.3'; +local $ENV{DAKGL_DBNAME}="$dbdir/gray3.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),'updated attempt'); |