summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw2016-11-25 11:28:36 -0500
committerBarry Warsaw2016-11-25 11:36:35 -0500
commit7142a0ea33e800744036219998f36c2adf2f84e0 (patch)
tree7cef21b314bcec03edc26ed7c5ccf9d472a05105
parentcecb66d21dbe523ae516e1c30038084190f284b1 (diff)
downloadmailman-7142a0ea33e800744036219998f36c2adf2f84e0.tar.gz
mailman-7142a0ea33e800744036219998f36c2adf2f84e0.tar.zst
mailman-7142a0ea33e800744036219998f36c2adf2f84e0.zip
-rw-r--r--src/mailman/chains/hold.py2
-rw-r--r--src/mailman/chains/tests/test_hold.py18
2 files changed, 19 insertions, 1 deletions
diff --git a/src/mailman/chains/hold.py b/src/mailman/chains/hold.py
index 075191704..42fed66a6 100644
--- a/src/mailman/chains/hold.py
+++ b/src/mailman/chains/hold.py
@@ -142,7 +142,7 @@ class HoldChain(TerminalChainBase):
rule_misses = msgdata.get('rule_misses')
if rule_misses:
msg['X-Mailman-Rule-Misses'] = SEMISPACE.join(rule_misses)
- reasons = msgdata.get('moderation_reasons', ['N/A'])
+ reasons = msgdata.get('moderation_reasons', ['n/a'])
# Hold the message by adding it to the list's request database.
request_id = hold_message(mlist, msg, msgdata, SEMISPACE.join(reasons))
# Calculate a confirmation token to send to the author of the
diff --git a/src/mailman/chains/tests/test_hold.py b/src/mailman/chains/tests/test_hold.py
index fc8b8fd3b..6686c4777 100644
--- a/src/mailman/chains/tests/test_hold.py
+++ b/src/mailman/chains/tests/test_hold.py
@@ -139,6 +139,24 @@ A message body.
self.assertEqual(
data.get('_mod_reason'), 'TEST-REASON-1; TEST-REASON-2')
+ def test_hold_chain_no_reasons_given(self):
+ msg = mfs("""\
+From: anne@example.com
+To: test@example.com
+Subject: A message
+Message-ID: <ant>
+MIME-Version: 1.0
+
+A message body.
+""")
+ process_chain(self._mlist, msg, {}, start_chain='hold')
+ # No reason was given, so a default is used.
+ requests = IListRequests(self._mlist)
+ self.assertEqual(requests.count_of(RequestType.held_message), 1)
+ request = requests.of_type(RequestType.held_message)[0]
+ key, data = requests.get_request(request.id)
+ self.assertEqual(data.get('_mod_reason'), 'n/a')
+
def test_hold_chain_charset(self):
# Issue #144 - UnicodeEncodeError in the hold chain.
self._mlist.admin_immed_notify = True