------------------------------------------------------------
revno: 1324
committer: Mark Sapiro <[email protected]>
branch nick: 2.2
timestamp: Thu 2014-04-24 15:43:47 -0700
message:
Updated tests/test_handlers.py for recent changes to CookHeaders.py.
modified:
tests/test_handlers.py
--
lp:mailman/2.2
https://code.launchpad.net/~mailman-coders/mailman/2.2
Your team Mailman Checkins is subscribed to branch lp:mailman/2.2.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman/2.2/+edit-subscription
=== modified file 'tests/test_handlers.py'
--- tests/test_handlers.py 2013-12-20 02:35:09 +0000
+++ tests/test_handlers.py 2014-04-24 22:43:47 +0000
@@ -76,6 +76,7 @@
# Add a member
self._mlist.addNewMember('[email protected]')
self._mlist.personalize = False
+ self._mlist.dmarc_moderation_action = 0
def tearDown(self):
for f in os.listdir(mm_cfg.VIRGINQUEUE_DIR):
@@ -591,82 +592,197 @@
eq = self.assertEqual
mlist = self._mlist
mlist.reply_goes_to_list = 1
- msg = email.message_from_string("""\
-From: [email protected]
-
-""", Message.Message)
- CookHeaders.process(mlist, msg, {})
- eq(msg['reply-to'], '[email protected]')
- eq(msg.get_all('reply-to'), ['[email protected]'])
+ mlist.from_is_list = 0
+ msg = email.message_from_string("""\
+From: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'], '[email protected]')
+ eq(msg.get_all('reply-to'), None)
+
+ def test_reply_to_list_fil(self):
+ eq = self.assertEqual
+ mlist = self._mlist
+ mlist.reply_goes_to_list = 1
+ mlist.from_is_list = 1
+ msg = email.message_from_string("""\
+From: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'],
+ '[email protected], [email protected]')
+ eq(msg.get_all('reply-to'), None)
def test_reply_to_list_with_strip(self):
eq = self.assertEqual
mlist = self._mlist
mlist.reply_goes_to_list = 1
mlist.first_strip_reply_to = 1
- msg = email.message_from_string("""\
-From: [email protected]
-Reply-To: [email protected]
-
-""", Message.Message)
- CookHeaders.process(mlist, msg, {})
- eq(msg['reply-to'], '[email protected]')
- eq(msg.get_all('reply-to'), ['[email protected]'])
+ mlist.from_is_list = 0
+ msg = email.message_from_string("""\
+From: [email protected]
+Reply-To: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'], '[email protected]')
+ eq(msg.get_all('reply-to'), ['[email protected]'])
+
+ def test_reply_to_list_with_strip_fil(self):
+ eq = self.assertEqual
+ mlist = self._mlist
+ mlist.reply_goes_to_list = 1
+ mlist.first_strip_reply_to = 1
+ mlist.from_is_list = 1
+ msg = email.message_from_string("""\
+From: [email protected]
+Reply-To: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'], '[email protected]')
+ eq(msg.get_all('reply-to'), ['[email protected]'])
def test_reply_to_explicit(self):
eq = self.assertEqual
mlist = self._mlist
mlist.reply_goes_to_list = 2
- mlist.reply_to_address = '[email protected]'
- msg = email.message_from_string("""\
-From: [email protected]
-
-""", Message.Message)
- CookHeaders.process(mlist, msg, {})
- eq(msg['reply-to'], '[email protected]')
- eq(msg.get_all('reply-to'), ['[email protected]'])
+ mlist.from_is_list = 0
+ mlist.reply_to_address = '[email protected]'
+ msg = email.message_from_string("""\
+From: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'], '[email protected]')
+ eq(msg.get_all('reply-to'), None)
+
+ def test_reply_to_explicit_fil(self):
+ eq = self.assertEqual
+ mlist = self._mlist
+ mlist.reply_goes_to_list = 2
+ mlist.from_is_list = 1
+ mlist.reply_to_address = '[email protected]'
+ msg = email.message_from_string("""\
+From: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'],
+ '[email protected], [email protected]')
+ eq(msg.get_all('reply-to'), None)
def test_reply_to_explicit_with_strip(self):
eq = self.assertEqual
mlist = self._mlist
mlist.reply_goes_to_list = 2
mlist.first_strip_reply_to = 1
- mlist.reply_to_address = '[email protected]'
- msg = email.message_from_string("""\
-From: [email protected]
-Reply-To: [email protected]
-
-""", Message.Message)
- CookHeaders.process(self._mlist, msg, {})
- eq(msg['reply-to'], '[email protected]')
- eq(msg.get_all('reply-to'), ['[email protected]'])
+ mlist.from_is_list = 0
+ mlist.reply_to_address = '[email protected]'
+ msg = email.message_from_string("""\
+From: [email protected]
+Reply-To: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+
+ CookHeaders.process(self._mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'], '[email protected]')
+ eq(msg.get_all('reply-to'), ['[email protected]'])
+
+ def test_reply_to_explicit_with_strip_fil(self):
+ eq = self.assertEqual
+ mlist = self._mlist
+ mlist.reply_goes_to_list = 2
+ mlist.first_strip_reply_to = 1
+ mlist.from_is_list = 1
+ mlist.reply_to_address = '[email protected]'
+ msg = email.message_from_string("""\
+From: [email protected]
+Reply-To: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+
+ CookHeaders.process(self._mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'], '[email protected]')
+ eq(msg.get_all('reply-to'), ['[email protected]'])
def test_reply_to_extends_to_list(self):
eq = self.assertEqual
mlist = self._mlist
mlist.reply_goes_to_list = 1
mlist.first_strip_reply_to = 0
- msg = email.message_from_string("""\
-From: [email protected]
-Reply-To: [email protected]
-
-""", Message.Message)
- CookHeaders.process(mlist, msg, {})
- eq(msg['reply-to'], '[email protected], [email protected]')
+ mlist.from_is_list = 0
+ msg = email.message_from_string("""\
+From: [email protected]
+Reply-To: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'],
+ '[email protected], [email protected]')
+
+ def test_reply_to_extends_to_list_fil(self):
+ eq = self.assertEqual
+ mlist = self._mlist
+ mlist.reply_goes_to_list = 1
+ mlist.first_strip_reply_to = 0
+ mlist.from_is_list = 1
+ msg = email.message_from_string("""\
+From: [email protected]
+Reply-To: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'],
+ '[email protected], [email protected], [email protected]')
def test_reply_to_extends_to_explicit(self):
eq = self.assertEqual
mlist = self._mlist
mlist.reply_goes_to_list = 2
mlist.first_strip_reply_to = 0
- mlist.reply_to_address = '[email protected]'
- msg = email.message_from_string("""\
-From: [email protected]
-Reply-To: [email protected]
-
-""", Message.Message)
- CookHeaders.process(mlist, msg, {})
- eq(msg['reply-to'], '[email protected], [email protected]')
+ mlist.from_is_list = 0
+ mlist.reply_to_address = '[email protected]'
+ msg = email.message_from_string("""\
+From: [email protected]
+Reply-To: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'],
+ '[email protected], [email protected]')
+
+ def test_reply_to_extends_to_explicit_fil(self):
+ eq = self.assertEqual
+ mlist = self._mlist
+ mlist.reply_goes_to_list = 2
+ mlist.first_strip_reply_to = 0
+ mlist.from_is_list = 1
+ mlist.reply_to_address = '[email protected]'
+ msg = email.message_from_string("""\
+From: [email protected]
+Reply-To: [email protected]
+
+""", Message.Message)
+ msgdata = {}
+ CookHeaders.process(mlist, msg, msgdata)
+ eq(msgdata['add_header']['Reply-To'],
+ '[email protected], [email protected], [email protected]')
def test_list_headers_nolist(self):
eq = self.assertEqual
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org