------------------------------------------------------------
revno: 1467
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.1
timestamp: Thu 2014-04-24 15:43:30 -0700
message:
  Updated tests/test_handlers.py for recent changes to CookHeaders.py.
modified:
  tests/test_handlers.py


--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1

Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'tests/test_handlers.py'
--- tests/test_handlers.py	2013-12-20 02:30:55 +0000
+++ tests/test_handlers.py	2014-04-24 22:43:30 +0000
@@ -76,6 +76,7 @@
         # Add a member
         self._mlist.addNewMember('aper...@dom.ain')
         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: aper...@dom.ain
-
-""", Message.Message)
-        CookHeaders.process(mlist, msg, {})
-        eq(msg['reply-to'], '_xt...@dom.ain')
-        eq(msg.get_all('reply-to'), ['_xt...@dom.ain'])
+        mlist.from_is_list = 0
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'], '_xt...@dom.ain')
+        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: aper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'],
+            'aper...@dom.ain, _xt...@dom.ain')
+        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: aper...@dom.ain
-Reply-To: bper...@dom.ain
-
-""", Message.Message)
-        CookHeaders.process(mlist, msg, {})
-        eq(msg['reply-to'], '_xt...@dom.ain')
-        eq(msg.get_all('reply-to'), ['_xt...@dom.ain'])
+        mlist.from_is_list = 0
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+Reply-To: bper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'], '_xt...@dom.ain')
+        eq(msg.get_all('reply-to'), ['bper...@dom.ain'])
+
+    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: aper...@dom.ain
+Reply-To: bper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'], '_xt...@dom.ain')
+        eq(msg.get_all('reply-to'), ['bper...@dom.ain'])
 
     def test_reply_to_explicit(self):
         eq = self.assertEqual
         mlist = self._mlist
         mlist.reply_goes_to_list = 2
-        mlist.reply_to_address = 'ml...@dom.ain'
-        msg = email.message_from_string("""\
-From: aper...@dom.ain
-
-""", Message.Message)
-        CookHeaders.process(mlist, msg, {})
-        eq(msg['reply-to'], 'ml...@dom.ain')
-        eq(msg.get_all('reply-to'), ['ml...@dom.ain'])
+        mlist.from_is_list = 0
+        mlist.reply_to_address = 'ml...@dom.ain'
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'], 'ml...@dom.ain')
+        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 = 'ml...@dom.ain'
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'],
+            'ml...@dom.ain, aper...@dom.ain')
+        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 = 'ml...@dom.ain'
-        msg = email.message_from_string("""\
-From: aper...@dom.ain
-Reply-To: bper...@dom.ain
-
-""", Message.Message)
-        CookHeaders.process(self._mlist, msg, {})
-        eq(msg['reply-to'], 'ml...@dom.ain')
-        eq(msg.get_all('reply-to'), ['ml...@dom.ain'])
+        mlist.from_is_list = 0
+        mlist.reply_to_address = 'ml...@dom.ain'
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+Reply-To: bper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+
+        CookHeaders.process(self._mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'], 'ml...@dom.ain')
+        eq(msg.get_all('reply-to'), ['bper...@dom.ain'])
+
+    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 = 'ml...@dom.ain'
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+Reply-To: bper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+
+        CookHeaders.process(self._mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'], 'ml...@dom.ain')
+        eq(msg.get_all('reply-to'), ['bper...@dom.ain'])
 
     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: aper...@dom.ain
-Reply-To: bper...@dom.ain
-
-""", Message.Message)
-        CookHeaders.process(mlist, msg, {})
-        eq(msg['reply-to'], 'bper...@dom.ain, _xt...@dom.ain')
+        mlist.from_is_list = 0
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+Reply-To: bper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'],
+            'bper...@dom.ain, _xt...@dom.ain')
+
+    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: aper...@dom.ain
+Reply-To: bper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'],
+            'aper...@dom.ain, bper...@dom.ain, _xt...@dom.ain')
 
     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 = 'ml...@dom.ain'
-        msg = email.message_from_string("""\
-From: aper...@dom.ain
-Reply-To: bper...@dom.ain
-
-""", Message.Message)
-        CookHeaders.process(mlist, msg, {})
-        eq(msg['reply-to'], 'ml...@dom.ain, bper...@dom.ain')
+        mlist.from_is_list = 0
+        mlist.reply_to_address = 'ml...@dom.ain'
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+Reply-To: bper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'],
+            'ml...@dom.ain, bper...@dom.ain')
+
+    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 = 'ml...@dom.ain'
+        msg = email.message_from_string("""\
+From: aper...@dom.ain
+Reply-To: bper...@dom.ain
+
+""", Message.Message)
+        msgdata = {}
+        CookHeaders.process(mlist, msg, msgdata)
+        eq(msgdata['add_header']['Reply-To'],
+            'ml...@dom.ain, aper...@dom.ain, bper...@dom.ain')
 
     def test_list_headers_nolist(self):
         eq = self.assertEqual

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to