diff options
author | Mark Sapiro <mark@msapiro.net> | 2014-04-24 15:43:30 -0700 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2014-04-24 15:43:30 -0700 |
commit | f596796ca5ed60c2c4e75b9f192aa6c8236b8852 (patch) | |
tree | acd5fb9059f11b90fbf91efb941224b7e180e320 /tests/test_handlers.py | |
parent | e700b13082fa55f9172c04fba6366a4a3e859ff5 (diff) | |
download | mailman2-f596796ca5ed60c2c4e75b9f192aa6c8236b8852.tar.gz mailman2-f596796ca5ed60c2c4e75b9f192aa6c8236b8852.tar.xz mailman2-f596796ca5ed60c2c4e75b9f192aa6c8236b8852.zip |
Updated tests/test_handlers.py for recent changes to CookHeaders.py.
Diffstat (limited to 'tests/test_handlers.py')
-rw-r--r-- | tests/test_handlers.py | 148 |
1 files changed, 132 insertions, 16 deletions
diff --git a/tests/test_handlers.py b/tests/test_handlers.py index b9529779..794288e8 100644 --- a/tests/test_handlers.py +++ b/tests/test_handlers.py @@ -76,6 +76,7 @@ class TestAcknowledge(TestBase): # Add a member self._mlist.addNewMember('aperson@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 @@ Subject: Re: [XTEST] About Mailman... eq = self.assertEqual mlist = self._mlist mlist.reply_goes_to_list = 1 + mlist.from_is_list = 0 msg = email.message_from_string("""\ From: aperson@dom.ain """, Message.Message) - CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], '_xtest@dom.ain') - eq(msg.get_all('reply-to'), ['_xtest@dom.ain']) + msgdata = {} + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], '_xtest@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: aperson@dom.ain + +""", Message.Message) + msgdata = {} + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], + 'aperson@dom.ain, _xtest@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 + mlist.from_is_list = 0 msg = email.message_from_string("""\ From: aperson@dom.ain Reply-To: bperson@dom.ain """, Message.Message) - CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], '_xtest@dom.ain') - eq(msg.get_all('reply-to'), ['_xtest@dom.ain']) + msgdata = {} + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], '_xtest@dom.ain') + eq(msg.get_all('reply-to'), ['bperson@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: aperson@dom.ain +Reply-To: bperson@dom.ain + +""", Message.Message) + msgdata = {} + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], '_xtest@dom.ain') + eq(msg.get_all('reply-to'), ['bperson@dom.ain']) def test_reply_to_explicit(self): eq = self.assertEqual mlist = self._mlist mlist.reply_goes_to_list = 2 + mlist.from_is_list = 0 + mlist.reply_to_address = 'mlist@dom.ain' + msg = email.message_from_string("""\ +From: aperson@dom.ain + +""", Message.Message) + msgdata = {} + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], 'mlist@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 = 'mlist@dom.ain' msg = email.message_from_string("""\ From: aperson@dom.ain """, Message.Message) - CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], 'mlist@dom.ain') - eq(msg.get_all('reply-to'), ['mlist@dom.ain']) + msgdata = {} + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], + 'mlist@dom.ain, aperson@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.from_is_list = 0 mlist.reply_to_address = 'mlist@dom.ain' msg = email.message_from_string("""\ From: aperson@dom.ain Reply-To: bperson@dom.ain """, Message.Message) - CookHeaders.process(self._mlist, msg, {}) - eq(msg['reply-to'], 'mlist@dom.ain') - eq(msg.get_all('reply-to'), ['mlist@dom.ain']) + msgdata = {} + + CookHeaders.process(self._mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], 'mlist@dom.ain') + eq(msg.get_all('reply-to'), ['bperson@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 = 'mlist@dom.ain' + msg = email.message_from_string("""\ +From: aperson@dom.ain +Reply-To: bperson@dom.ain + +""", Message.Message) + msgdata = {} + + CookHeaders.process(self._mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], 'mlist@dom.ain') + eq(msg.get_all('reply-to'), ['bperson@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 + mlist.from_is_list = 0 + msg = email.message_from_string("""\ +From: aperson@dom.ain +Reply-To: bperson@dom.ain + +""", Message.Message) + msgdata = {} + + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], + 'bperson@dom.ain, _xtest@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: aperson@dom.ain Reply-To: bperson@dom.ain """, Message.Message) - CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], 'bperson@dom.ain, _xtest@dom.ain') + msgdata = {} + + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], + 'aperson@dom.ain, bperson@dom.ain, _xtest@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.from_is_list = 0 + mlist.reply_to_address = 'mlist@dom.ain' + msg = email.message_from_string("""\ +From: aperson@dom.ain +Reply-To: bperson@dom.ain + +""", Message.Message) + msgdata = {} + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], + 'mlist@dom.ain, bperson@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 = 'mlist@dom.ain' msg = email.message_from_string("""\ From: aperson@dom.ain Reply-To: bperson@dom.ain """, Message.Message) - CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], 'mlist@dom.ain, bperson@dom.ain') + msgdata = {} + CookHeaders.process(mlist, msg, msgdata) + eq(msgdata['add_header']['Reply-To'], + 'mlist@dom.ain, aperson@dom.ain, bperson@dom.ain') def test_list_headers_nolist(self): eq = self.assertEqual |