File: dcc.t

package info (click to toggle)
spamassassin 4.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,732 kB
  • sloc: perl: 89,143; ansic: 5,193; sh: 3,737; javascript: 339; sql: 295; makefile: 209; python: 49
file content (54 lines) | stat: -rwxr-xr-x 1,532 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -T

use lib '.'; use lib 't';
use SATest; sa_t_init("dcc");

use constant HAS_DCC => !$RUNNING_ON_WINDOWS && eval { $_ = untaint_cmd("which cdcc"); chomp; -x };

use Test::More;
plan skip_all => "Tests don't work on windows" if $RUNNING_ON_WINDOWS;
plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
plan skip_all => "DCC tests disabled" unless conf_bool('run_dcc_tests');
plan skip_all => "DCC executable not found in path" unless HAS_DCC;
plan tests => 12;

diag('Note: Failure may not be an SpamAssassin bug, as DCC tests can fail due to problems with the DCC servers.');


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

%patterns = (
  q{ spam reported to DCC }, 'dcc report',
);

tstprefs ("
  full     DCC_CHECK  eval:check_dcc()
  tflags   DCC_CHECK  net autolearn_body
  priority DCC_CHECK  10
  dns_available no
  use_dcc 1
  meta X_META_POS DCC_CHECK
  meta X_META_NEG !DCC_CHECK
  score DCC_CHECK 3.3
  score X_META_POS 3.3
  score X_META_NEG 3.3
");

ok sarun ("-t -D info -r < data/spam/gtubedcc.eml 2>&1", \&patterns_run_cb);
ok_all_patterns();
ok sarun ("-t -D info -r < data/spam/gtubedcc_crlf.eml 2>&1", \&patterns_run_cb);
ok_all_patterns();

%patterns = (
  q{ 3.3 DCC_CHECK }, 'dcc',
  q{ 3.3 X_META_POS }, 'pos',
);
%anti_patterns = (
  q{ X_META_NEG }, 'neg',
);

ok sarun ("-t < data/spam/gtubedcc.eml 2>&1", \&patterns_run_cb);
ok_all_patterns();
ok sarun ("-t < data/spam/gtubedcc_crlf.eml 2>&1", \&patterns_run_cb);
ok_all_patterns();