aboutsummaryrefslogtreecommitdiff
path: root/tests/hmod.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hmod.at')
-rw-r--r--tests/hmod.at110
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/>.
16AT_SETUP([Modify the message header])
17AT_KEYWORDS([header modify])
18
19AT_ANUBIS_CONFIG([anubis.rc],
20[BEGIN CONTROL
21logfile $PWD/etc/anubis.log
22local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
23use-pam no
24END
25
26BEGIN RULE
27if 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!"
31fi
32
33if header[[Subject]] = :scase "Renegades of Funk"
34 modify [[Subject]] "[[RATM \\\& music]] &"
35fi
36END
37])
38
39AT_DATA([input],
40[HELO localhost
41MAIL FROM:<polak@gnu.org>
42RCPT TO:<gray@gnu.org>
43DATA
44From: <polak@gnu.org>
45To: <gray@gnu.org>
46Subject: Hybrid Theory
47Subject: Meteora
48X-Mailer: Fake MTA
49X-Old-Mailer: Fake MTA
50X-LP-InTheEnd: rocks
51X-LP-Faint: rules!
52
53I can't feel the way I did before
54Don't turn your back on me
55I won't be ignored
56Time won't heal this damage anymore
57Don't turn your back on me
58I won't be ignored
59.
60MAIL FROM:<polak@gnu.org>
61RCPT TO:<gray@gnu.org>
62DATA
63From: <polak@gnu.org>
64To: <gray@gnu.org>
65Subject: Renegades of Funk
66
67No matter how hard you try,
68you can't stop us now!
69.
70QUIT
71])
72
73AT_CHECK([
74anubis --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
78250 pleased to meet you
79250 Sender OK
80250 Recipient OK
81354 Enter mail, end with "." on a line by itself
82250 Mail accepted for delivery
83250 Sender OK
84250 Recipient OK
85354 Enter mail, end with "." on a line by itself
86250 Mail accepted for delivery
87221 Done
88],
89[ignore])
90
91AT_CHECK([diff input etc/mta.log],
92[1],
93[[7d6
94< Subject: Hybrid Theory
959c8
96< X-Mailer: Fake MTA
97---
98> Subject: Meteora
9911c10
100< X-LP-InTheEnd: rocks
101---
102> X-Old-Old-Mailer: Fake MTA
10312a12
104> X-Old-LP-Faint: rules!
10526c26
106< Subject: Renegades of Funk
107---
108> Subject: [RATM & music] Renegades of Funk
109]])
110AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.