]> git.proxmox.com Git - proxmox-spamassassin.git/blob - upstream/t/hashcash.t
bump version to 3.4.6-5
[proxmox-spamassassin.git] / upstream / t / hashcash.t
1 #!/usr/bin/perl -T
2
3 use lib '.'; use lib 't';
4 use SATest; sa_t_init("hashcash");
5
6 # we need DB_File to support the double-spend db.
7 use constant HAS_DB_FILE => eval { require DB_File };
8
9 use Test::More;
10 plan skip_all => "This test requires DB_File" unless HAS_DB_FILE;
11 plan tests => 4;
12
13 # ---------------------------------------------------------------------------
14
15 %patterns = (
16 q{ HASHCASH_24 }, 'hashcash24',
17 );
18
19 tstprefs ('
20 hashcash_accept test@example.com test1@example.com test2@example.com
21 hashcash_doublespend_path log/user_state/hashcash_seen
22 ');
23
24 sarun ("-L -t < data/nice/001", \&patterns_run_cb);
25 ok_all_patterns();
26
27 %patterns = (
28 q{ HASHCASH_20 }, 'hashcash20',
29 );
30
31 sarun ("-L -t < data/nice/001", \&patterns_run_cb);
32 ok_all_patterns();
33
34 %patterns = (
35 q{ HASHCASH_2SPEND }, '2spend',
36 );
37
38 sarun ("-L -t < data/nice/001", \&patterns_run_cb);
39 ok_all_patterns();
40
41 # try again with a mail with 2 tokens, one unspent.
42 %patterns = ();
43 %anti_patterns = (
44 q{ HASHCASH_2SPEND }, '2spend',
45 );
46 sarun ("-L -t < data/nice/016", \&patterns_run_cb);
47 ok_all_patterns();
48