diff options
| author | Aurélien Bompard | 2015-09-12 10:54:22 +0200 |
|---|---|---|
| committer | Aurélien Bompard | 2015-09-12 10:54:22 +0200 |
| commit | 2d82e2c93b1b5a243c53edc2a0b8a5be1dabb5f8 (patch) | |
| tree | 88b61d251de5db3308cee96b6812dce0d23938f1 /src | |
| parent | 18b4c4b06735c4b5998a8dfacce35c38137c0905 (diff) | |
| download | mailman-2d82e2c93b1b5a243c53edc2a0b8a5be1dabb5f8.tar.gz mailman-2d82e2c93b1b5a243c53edc2a0b8a5be1dabb5f8.tar.zst mailman-2d82e2c93b1b5a243c53edc2a0b8a5be1dabb5f8.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/core/pipelines.py | 2 | ||||
| -rw-r--r-- | src/mailman/core/tests/test_pipelines.py | 40 |
2 files changed, 40 insertions, 2 deletions
diff --git a/src/mailman/core/pipelines.py b/src/mailman/core/pipelines.py index 2c0f7c221..2a42b1b67 100644 --- a/src/mailman/core/pipelines.py +++ b/src/mailman/core/pipelines.py @@ -118,12 +118,12 @@ class PostingPipeline(BasePipeline): 'cook-headers', 'subject-prefix', 'rfc-2369', - 'decorate', 'to-archive', 'to-digest', 'to-usenet', 'after-delivery', 'acknowledge', + 'decorate', 'to-outgoing', ) diff --git a/src/mailman/core/tests/test_pipelines.py b/src/mailman/core/tests/test_pipelines.py index 173be0dd9..b9074d033 100644 --- a/src/mailman/core/tests/test_pipelines.py +++ b/src/mailman/core/tests/test_pipelines.py @@ -34,7 +34,7 @@ from mailman.interfaces.member import MemberRole from mailman.interfaces.pipeline import IPipeline from mailman.interfaces.usermanager import IUserManager from mailman.testing.helpers import ( - LogFileMark, get_queue_messages, reset_the_world, + LogFileMark, get_queue_messages, reset_the_world, digest_mbox, specialized_message_from_string as mfs) from mailman.testing.layers import ConfigLayer from zope.component import getUtility @@ -133,6 +133,44 @@ testing self.assertEqual(len(messages), 1) self.assertEqual(str(messages[0].msg['subject']), 'a test') + def test_decorate_bulk(self): + # Ensure that bulk postings get decorated with the footer. + msgdata = {} + process(self._mlist, self._msg, msgdata, + pipeline_name='default-posting-pipeline') + payload = self._msg.get_payload() + self.assertIn('Test mailing list', payload) + + def test_nodecorate_verp(self): + # Ensure that verp postings don't get decorated twice. + msgdata = {'verp': True} + process(self._mlist, self._msg, msgdata, + pipeline_name='default-posting-pipeline') + payload = self._msg.get_payload() + self.assertEqual(payload.count('Test mailing list'), 1) + + def test_only_decorate_output(self): + # Ensure that decoration is not done on the archive, digest or usenet + # copy. + self.assertTrue(self._mlist.digestable) + # setup NNTP + self._mlist.gateway_to_news = True + self._mlist.linked_newsgroup = "testing" + self._mlist.nntp_host = 'news.example.com' + # process the email + msgdata = {} + process(self._mlist, self._msg, msgdata, + pipeline_name='default-posting-pipeline') + for queue in ('archive', 'nntp'): + messages = get_queue_messages(queue) + self.assertEqual(len(messages), 1, + 'Queue {} has {} messages'.format(queue, len(messages))) + payload = messages[0].msg.get_payload() + self.assertNotIn('Test mailing list', payload) + self.assertEqual(len(digest_mbox(self._mlist)), 1) + payload = digest_mbox(self._mlist)[0].get_payload() + self.assertNotIn('Test mailing list', payload) + class TestOwnerPipeline(unittest.TestCase): |
