diff options
| -rw-r--r-- | src/mailman/chains/hold.py | 2 | ||||
| -rw-r--r-- | src/mailman/chains/tests/test_hold.py | 18 |
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 |
