#!/usr/bin/perl -T
use
SATest; sa_t_init(
"pyzor"
);
use
constant
HAS_PYZOR
=> Mail::SpamAssassin::Util::find_executable_in_env_path(
'pyzor'
);
plan
skip_all
=>
"Net tests disabled"
unless
conf_bool(
'run_net_tests'
);
plan
skip_all
=>
"Pyzor executable not found in path"
unless
HAS_PYZOR;
plan
tests
=> 20;
diag(
'Note: Failures may not be an SpamAssassin bug, as Pyzor tests can fail due to problems with the Pyzor servers.'
);
tstprefs ("
full PYZOR_CHECK
eval
:check_pyzor()
tflags PYZOR_CHECK net autolearn_body
dns_available
no
use_pyzor 1
pyzor_count_min 1
score PYZOR_CHECK 3.3
");
%patterns
= (
q{ spam reported to Pyzor }
,
'pyzor report'
,
);
ok sarun (
"--cf=\"pyzor_fork 0\" -t -D info -r < data/spam/pyzor 2>&1"
, \
&patterns_run_cb
);
ok_all_patterns();
%patterns
= (
q{ 3.3 PYZOR_CHECK }
,
'spam'
,
);
ok sarun (
"--cf=\"pyzor_fork 0\" -t < data/spam/pyzor"
, \
&patterns_run_cb
);
ok_all_patterns();
ok sarun (
"--cf=\"pyzor_fork 1\" -t < data/spam/pyzor"
, \
&patterns_run_cb
);
ok_all_patterns();
ok sarun (
"--cf=\"pyzor_fork 0\" --cf=\"pyzor_perl 1\" -t < data/spam/pyzor"
, \
&patterns_run_cb
);
ok_all_patterns();
%patterns
= (
'pyzor: got response: public.pyzor.org'
=>
'response'
,
'pyzor: result: COUNT=0'
=>
'zerocount'
,
);
%anti_patterns
= (
q{ 3.3 PYZOR_CHECK }
,
'nonspam'
,
);
ok sarun (
"-D pyzor --cf=\"pyzor_fork 0\" -t < data/nice/001 2>&1"
, \
&patterns_run_cb
);
ok_all_patterns();
ok sarun (
"-D pyzor --cf=\"pyzor_fork 1\" -t < data/nice/001 2>&1"
, \
&patterns_run_cb
);
ok_all_patterns();
ok sarun (
"-D pyzor --cf=\"pyzor_fork 0\" --cf=\"pyzor_perl 1\" -t < data/nice/001 2>&1"
, \
&patterns_run_cb
);
ok_all_patterns();