summaryrefslogtreecommitdiff
path: root/src/mailman/core/tests
diff options
context:
space:
mode:
authorBarry Warsaw2015-09-13 20:30:19 +0000
committerBarry Warsaw2015-09-13 20:30:19 +0000
commit2f6a250ca38a8846c1d417c380d6311de35c3ee7 (patch)
tree79a077b3a16f18cea95e3f7b0620cebcab6f887b /src/mailman/core/tests
parentccedcb5f4efaeb14300626ca00b3baf34af6e6e5 (diff)
parent9c710fe9fa1f95eb5eeafe29b0933bdf01492154 (diff)
downloadmailman-2f6a250ca38a8846c1d417c380d6311de35c3ee7.tar.gz
mailman-2f6a250ca38a8846c1d417c380d6311de35c3ee7.tar.zst
mailman-2f6a250ca38a8846c1d417c380d6311de35c3ee7.zip
Merge branch 'issue145' into 'master'
Clean up branch to fix issue 145 (bulk emails not being decorated) Clean up branch based on abompard's branch. See merge request !44
Diffstat (limited to 'src/mailman/core/tests')
-rw-r--r--src/mailman/core/tests/test_pipelines.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/mailman/core/tests/test_pipelines.py b/src/mailman/core/tests/test_pipelines.py
index 173be0dd9..134392668 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, digest_mbox, get_queue_messages, reset_the_world,
specialized_message_from_string as mfs)
from mailman.testing.layers import ConfigLayer
from zope.component import getUtility
@@ -133,6 +133,43 @@ 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.
+ process(self._mlist, self._msg, {},
+ 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 of the message.
+ self.assertTrue(self._mlist.digestable)
+ # Set up NNTP.
+ self._mlist.gateway_to_news = True
+ self._mlist.linked_newsgroup = 'testing'
+ self._mlist.nntp_host = 'news.example.com'
+ # Process the email.
+ process(self._mlist, self._msg, {},
+ 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):