File: whitelist_from.t

package info (click to toggle)
spamassassin 3.1.7-2etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 5,404 kB
  • ctags: 2,123
  • sloc: perl: 39,706; ansic: 3,133; sh: 2,009; sql: 170; makefile: 168
file content (82 lines) | stat: -rwxr-xr-x 2,607 bytes parent folder | download | duplicates (4)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/perl

use lib '.'; use lib 't';
use SATest; sa_t_init("whitelist_from");
use Test; BEGIN { plan tests => 32 };

# ---------------------------------------------------------------------------

tstprefs ("
        def_whitelist_from_rcvd *\@paypal.com paypal.com
        def_whitelist_from_rcvd *\@paypal.com ebay.com
        def_whitelist_from_rcvd mumble\@example.com example.com
        whitelist_from_rcvd foo\@example.com spamassassin.org
        whitelist_from_rcvd foo\@example.com example.com
        whitelist_from_rcvd bar\@example.com example.com
        whitelist_allows_relays bar\@example.com
        whitelist_from baz\@example.com
        whitelist_from bam\@example.com
        unwhitelist_from bam\@example.com
        unwhitelist_from_rcvd mumble\@example.com
	");

# tests 1 - 4 does whitelist_from work?
%patterns = (
             q{ USER_IN_WHITELIST }, 'w1'
             );

%anti_patterns = (
             q{ FORGED_IN_WHITELIST }, 'a2',
             q{ USER_IN_DEF_WHITELIST }, 'a3',
             q{ FORGED_IN_DEF_WHITELIST }, 'a4'
             );
sarun ("-L -t < data/nice/008", \&patterns_run_cb);
ok_all_patterns();

# tests 5 - 8 does whitelist_from_rcvd work?
sarun ("-L -t < data/nice/009", \&patterns_run_cb);
ok_all_patterns();

# tests 9 - 12 second relay specified for same addr in whitelist_from_rcvd
sarun ("-L -t < data/nice/010", \&patterns_run_cb);
ok_all_patterns();

%patterns = (
             q{ USER_IN_DEF_WHITELIST }, 'w5'
             );

%anti_patterns = (
             q{ USER_IN_WHITELIST }, 'a6',
             q{ FORGED_IN_WHITELIST }, 'a7',
             q{ FORGED_IN_DEF_WHITELIST }, 'a8'
             );

# tests 13 - 16 does def_whitelist_from_rcvd work?
sarun ("-L -t < data/nice/011", \&patterns_run_cb);
ok_all_patterns();

# tests 17 - 20 second relay specified for same addr in def_whitelist_from_rcvd
sarun ("-L -t < data/nice/012", \&patterns_run_cb);
ok_all_patterns();

%patterns = ();

%anti_patterns = (
             q{ USER_IN_WHITELIST }, 'a9',
             q{ FORGED_IN_WHITELIST }, 'a10',
             q{ USER_IN_DEF_WHITELIST }, 'a11',
             q{ FORGED_IN_DEF_WHITELIST }, 'a12'
             );
# tests 21 - 24 does whitelist_allows_relays suppress the forged rule without
#  putting the address on the whitelist?
sarun ("-L -t < data/nice/013", \&patterns_run_cb);
ok_all_patterns();

# tests 25 - 28 does unwhitelist_from work?
sarun ("-L -t < data/nice/014", \&patterns_run_cb);
ok_all_patterns();

# tests 29 - 32 does unwhitelist_from_rcvd work?
sarun ("-L -t < data/nice/015", \&patterns_run_cb);
ok_all_patterns();