diff options
Diffstat (limited to 'tests/hmod.at')
-rw-r--r-- | tests/hmod.at | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/tests/hmod.at b/tests/hmod.at new file mode 100644 index 0000000..1a041c6 --- /dev/null +++ b/tests/hmod.at | |||
@@ -0,0 +1,110 @@ | |||
1 | # This file is part of GNU Anubis testsuite. -*- autotest -*- | ||
2 | # Copyright (C) 2003-2024 The Anubis Team. | ||
3 | # | ||
4 | # GNU Anubis is free software; you can redistribute it and/or modify it | ||
5 | # under the terms of the GNU General Public License as published by the Free | ||
6 | # Software Foundation; either version 3 of the License, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # GNU Anubis is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License along | ||
15 | # with GNU Anubis. If not, see <http://www.gnu.org/licenses/>. | ||
16 | AT_SETUP([Modify the message header]) | ||
17 | AT_KEYWORDS([header modify]) | ||
18 | |||
19 | AT_ANUBIS_CONFIG([anubis.rc], | ||
20 | [BEGIN CONTROL | ||
21 | logfile $PWD/etc/anubis.log | ||
22 | local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log | ||
23 | use-pam no | ||
24 | END | ||
25 | |||
26 | BEGIN RULE | ||
27 | if header[[Subject]] = :scase "Hybrid Theory" | ||
28 | modify [[Subject]] "Meteora" | ||
29 | modify header :re [["X-\(.*\)"]] [["X-Old-\1"]] | ||
30 | modify header [[X-Old-LP-InTheEnd]] [[X-LP-Faint]] "rules!" | ||
31 | fi | ||
32 | |||
33 | if header[[Subject]] = :scase "Renegades of Funk" | ||
34 | modify [[Subject]] "[[RATM \\\& music]] &" | ||
35 | fi | ||
36 | END | ||
37 | ]) | ||
38 | |||
39 | AT_DATA([input], | ||
40 | [HELO localhost | ||
41 | MAIL FROM:<polak@gnu.org> | ||
42 | RCPT TO:<gray@gnu.org> | ||
43 | DATA | ||
44 | From: <polak@gnu.org> | ||
45 | To: <gray@gnu.org> | ||
46 | Subject: Hybrid Theory | ||
47 | Subject: Meteora | ||
48 | X-Mailer: Fake MTA | ||
49 | X-Old-Mailer: Fake MTA | ||
50 | X-LP-InTheEnd: rocks | ||
51 | X-LP-Faint: rules! | ||
52 | |||
53 | I can't feel the way I did before | ||
54 | Don't turn your back on me | ||
55 | I won't be ignored | ||
56 | Time won't heal this damage anymore | ||
57 | Don't turn your back on me | ||
58 | I won't be ignored | ||
59 | . | ||
60 | MAIL FROM:<polak@gnu.org> | ||
61 | RCPT TO:<gray@gnu.org> | ||
62 | DATA | ||
63 | From: <polak@gnu.org> | ||
64 | To: <gray@gnu.org> | ||
65 | Subject: Renegades of Funk | ||
66 | |||
67 | No matter how hard you try, | ||
68 | you can't stop us now! | ||
69 | . | ||
70 | QUIT | ||
71 | ]) | ||
72 | |||
73 | AT_CHECK([ | ||
74 | anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r' | ||
75 | ], | ||
76 | [0], | ||
77 | [220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready | ||
78 | 250 pleased to meet you | ||
79 | 250 Sender OK | ||
80 | 250 Recipient OK | ||
81 | 354 Enter mail, end with "." on a line by itself | ||
82 | 250 Mail accepted for delivery | ||
83 | 250 Sender OK | ||
84 | 250 Recipient OK | ||
85 | 354 Enter mail, end with "." on a line by itself | ||
86 | 250 Mail accepted for delivery | ||
87 | 221 Done | ||
88 | ], | ||
89 | [ignore]) | ||
90 | |||
91 | AT_CHECK([diff input etc/mta.log], | ||
92 | [1], | ||
93 | [[7d6 | ||
94 | < Subject: Hybrid Theory | ||
95 | 9c8 | ||
96 | < X-Mailer: Fake MTA | ||
97 | --- | ||
98 | > Subject: Meteora | ||
99 | 11c10 | ||
100 | < X-LP-InTheEnd: rocks | ||
101 | --- | ||
102 | > X-Old-Old-Mailer: Fake MTA | ||
103 | 12a12 | ||
104 | > X-Old-LP-Faint: rules! | ||
105 | 26c26 | ||
106 | < Subject: Renegades of Funk | ||
107 | --- | ||
108 | > Subject: [RATM & music] Renegades of Funk | ||
109 | ]]) | ||
110 | AT_CLEANUP | ||