-
Notifications
You must be signed in to change notification settings - Fork 70
/
whitelist_subject.t
executable file
·62 lines (47 loc) · 1.79 KB
/
whitelist_subject.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
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl -T
use lib '.'; use lib 't';
use SATest; sa_t_init("whitelist_subject");
use Test::More tests => 4;
# ---------------------------------------------------------------------------
disable_compat "welcomelist_blocklist";
%is_whitelist_patterns = (
q{ SUBJECT_IN_WHITELIST }, 'whitelist-subject'
);
%is_blacklist_patterns = (
q{ SUBJECT_IN_BLACKLIST }, 'blacklist-subject'
);
tstprefs ("
loadplugin Mail::SpamAssassin::Plugin::WhiteListSubject
header SUBJECT_IN_WELCOMELIST eval:check_subject_in_welcomelist()
tflags SUBJECT_IN_WELCOMELIST userconf nice noautolearn
score SUBJECT_IN_WELCOMELIST -100
if !can(Mail::SpamAssassin::Conf::compat_welcomelist_blocklist)
meta SUBJECT_IN_WHITELIST (SUBJECT_IN_WELCOMELIST)
tflags SUBJECT_IN_WHITELIST userconf nice noautolearn
score SUBJECT_IN_WHITELIST -100
score SUBJECT_IN_WELCOMELIST -0.01
endif
header SUBJECT_IN_BLOCKLIST eval:check_subject_in_blocklist()
tflags SUBJECT_IN_BLOCKLIST userconf noautolearn
score SUBJECT_IN_BLOCKLIST 100
if !can(Mail::SpamAssassin::Conf::compat_welcomelist_blocklist)
meta SUBJECT_IN_BLACKLIST (SUBJECT_IN_BLOCKLIST)
tflags SUBJECT_IN_BLACKLIST userconf noautolearn
score SUBJECT_IN_BLACKLIST 100
score SUBJECT_IN_BLOCKLIST 0.01
endif
# Check that rename backwards compatibility works with if's
ifplugin Mail::SpamAssassin::Plugin::WhiteListSubject
if plugin(Mail::SpamAssassin::Plugin::WelcomeListSubject)
whitelist_subject [HC Anno*]
blacklist_subject whitelist test
endif
endif
");
%patterns = %is_whitelist_patterns;
ok(sarun ("-L -t < data/nice/016", \&patterns_run_cb));
ok_all_patterns();
%patterns = %is_blacklist_patterns;
# force us to blacklist a nice msg
ok(sarun ("-L -t < data/nice/015", \&patterns_run_cb));
ok_all_patterns();