summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBarry Warsaw2015-05-05 01:32:28 +0000
committerBarry Warsaw2015-05-05 01:32:28 +0000
commita80c61699f2e3bf60af44fac221ead8bdeff368c (patch)
tree0d17c1a25177a25e3c3dcbb15219d30946ee86b6 /src
parent18683868449fd855fcf68a82aef36a7c808e916e (diff)
parent597e5532d06892cdefdffe79a324660d49a6f4b1 (diff)
downloadmailman-a80c61699f2e3bf60af44fac221ead8bdeff368c.tar.gz
mailman-a80c61699f2e3bf60af44fac221ead8bdeff368c.tar.zst
mailman-a80c61699f2e3bf60af44fac221ead8bdeff368c.zip
Merge branch 'lp1165589' into 'master'
Prove that LP: #1165589 doesn't affect Mailman 3 This bug doesn't affect MM3. Add a test to prove this. Drive-by typo fix. Only apply this to MM3.1 since there's no bug here. See merge request !7
Diffstat (limited to 'src')
-rw-r--r--src/mailman/core/tests/test_switchboard.py58
-rw-r--r--src/mailman/model/docs/mlist-addresses.rst6
2 files changed, 61 insertions, 3 deletions
diff --git a/src/mailman/core/tests/test_switchboard.py b/src/mailman/core/tests/test_switchboard.py
new file mode 100644
index 000000000..b59218795
--- /dev/null
+++ b/src/mailman/core/tests/test_switchboard.py
@@ -0,0 +1,58 @@
+# Copyright (C) 2015 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
+
+"""Switchboard tests."""
+
+__all__ = [
+ 'TestSwitchboard',
+ ]
+
+
+import unittest
+
+from mailman.config import config
+from mailman.testing.helpers import (
+ LogFileMark,
+ specialized_message_from_string as mfs)
+from mailman.testing.layers import ConfigLayer
+from unittest.mock import patch
+
+
+class TestSwitchboard(unittest.TestCase):
+ layer = ConfigLayer
+
+ def test_log_exception_in_finish(self):
+ # If something bad happens in .finish(), the traceback should get
+ # logged. LP: #1165589.
+ msg = mfs("""\
+From: anne@example.com
+To: test@example.com
+Message-ID: <ant>
+
+""")
+ switchboard = config.switchboards['shunt']
+ # Enqueue the message.
+ filebase = switchboard.enqueue(msg)
+ error_log = LogFileMark('mailman.error')
+ msg, data = switchboard.dequeue(filebase)
+ # Now, cause .finish() to throw an exception.
+ with patch('mailman.core.switchboard.os.rename',
+ side_effect=OSError('Oops!')):
+ switchboard.finish(filebase, preserve=True)
+ traceback = error_log.read().splitlines()
+ self.assertEqual(traceback[1], 'Traceback (most recent call last):')
+ self.assertEqual(traceback[-1], 'OSError: Oops!')
diff --git a/src/mailman/model/docs/mlist-addresses.rst b/src/mailman/model/docs/mlist-addresses.rst
index d546b4962..456fc985c 100644
--- a/src/mailman/model/docs/mlist-addresses.rst
+++ b/src/mailman/model/docs/mlist-addresses.rst
@@ -45,9 +45,9 @@ deprecated.
>>> print(mlist.subscribe_address)
_xtest-subscribe@example.com
-The leave (a.k.a. unsubscribe) address is where someone can email to get added
-to the mailing list. The unsubscribe alias is a synonym for leave, but it's
-deprecated.
+The leave (a.k.a. unsubscribe) address is where someone can email to get
+removed from the mailing list. The unsubscribe alias is a synonym for leave,
+but it's deprecated.
>>> print(mlist.leave_address)
_xtest-leave@example.com