-
Notifications
You must be signed in to change notification settings - Fork 70
/
urilocalbl_geoip.t
executable file
·49 lines (37 loc) · 1.22 KB
/
urilocalbl_geoip.t
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
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl -T
BEGIN {
if (-e 't/test_dir') { # if we are running "t/rule_tests.t", kluge around ...
chdir 't';
}
if (-e 'test_dir') { # running from test directory, not ..
unshift(@INC, '../blib/lib');
unshift(@INC, '../lib');
}
}
use lib '.'; use lib 't';
use SATest; sa_t_init("urilocalbl");
use constant HAS_CIDR_LITE => eval { require Net::CIDR::Lite; };
use constant HAS_GEOIP => eval { require Geo::IP; };
use constant HAS_GEOIP_CONF => eval { Geo::IP->new(); };
use Test::More;
plan skip_all => "Net::CIDR::Lite not installed" unless HAS_CIDR_LITE;
plan skip_all => "Geo::IP not installed" unless HAS_GEOIP;
plan skip_all => "Geo::IP not configured" unless HAS_GEOIP_CONF;
plan tests => 3;
# ---------------------------------------------------------------------------
tstpre ("
loadplugin Mail::SpamAssassin::Plugin::URILocalBL
");
%patterns = (
q{ X_URIBL_USA } => 'USA',
q{ X_URIBL_NA } => 'north America',
);
tstlocalrules (q{
dns_available no
uri_block_cc X_URIBL_USA us
describe X_URIBL_USA uri located in USA
uri_block_cont X_URIBL_NA na
describe X_URIBL_NA uri located in north America
});
ok sarun ("-t < data/spam/relayUS.eml", \&patterns_run_cb);
ok_all_patterns();