diff options
author | Mark Sapiro <mark@msapiro.net> | 2015-01-03 18:24:24 -0800 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2015-01-03 18:24:24 -0800 |
commit | 85a6679a3ea5b1ff085453f4e1ed921b5320690b (patch) | |
tree | 13377507468a9d1fcc8459d0b90e55a3bf4cfb69 /tests | |
parent | d196f39ced49094eab5d0d8d8e42308835ef1cf5 (diff) | |
download | mailman2-85a6679a3ea5b1ff085453f4e1ed921b5320690b.tar.gz mailman2-85a6679a3ea5b1ff085453f4e1ed921b5320690b.tar.xz mailman2-85a6679a3ea5b1ff085453f4e1ed921b5320690b.zip |
When applying DMARC mitigations, CookHeaders now adds the original From:
to Cc: rather than Reply-To: in some cases to make MUA 'reply' and
'reply all' more consistent with the non-DMARC cases.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_handlers.py | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/tests/test_handlers.py b/tests/test_handlers.py index c3df0cb8..8f6219e8 100644 --- a/tests/test_handlers.py +++ b/tests/test_handlers.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2014 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2015 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -614,8 +614,11 @@ From: aperson@dom.ain msgdata = {} CookHeaders.process(mlist, msg, msgdata) eq(msgdata['add_header']['Reply-To'], - 'aperson@dom.ain, _xtest@dom.ain') + '_xtest@dom.ain') + eq(msgdata['add_header']['Cc'], + 'aperson@dom.ain') eq(msg.get_all('reply-to'), None) + eq(msg.get_all('cc'), None) def test_reply_to_list_with_strip(self): eq = self.assertEqual @@ -647,8 +650,12 @@ Reply-To: bperson@dom.ain msgdata = {} CookHeaders.process(mlist, msg, msgdata) eq(msgdata['add_header']['Reply-To'], - 'aperson@dom.ain, _xtest@dom.ain') + '_xtest@dom.ain') + eq(msgdata['add_header']['Cc'], + 'aperson@dom.ain') eq(msg.get_all('reply-to'), ['bperson@dom.ain']) + eq(msg.get_all('cc'), None) + def test_reply_to_explicit(self): eq = self.assertEqual @@ -678,8 +685,11 @@ From: aperson@dom.ain msgdata = {} CookHeaders.process(mlist, msg, msgdata) eq(msgdata['add_header']['Reply-To'], - 'mlist@dom.ain, aperson@dom.ain') + 'mlist@dom.ain') + eq(msgdata['add_header']['Cc'], + 'aperson@dom.ain') eq(msg.get_all('reply-to'), None) + eq(msg.get_all('cc'), None) def test_reply_to_explicit_with_strip(self): eq = self.assertEqual @@ -715,8 +725,11 @@ Reply-To: bperson@dom.ain CookHeaders.process(self._mlist, msg, msgdata) eq(msgdata['add_header']['Reply-To'], - 'mlist@dom.ain, aperson@dom.ain') + 'mlist@dom.ain') + eq(msgdata['add_header']['Cc'], + 'aperson@dom.ain') eq(msg.get_all('reply-to'), ['bperson@dom.ain']) + eq(msg.get_all('cc'), None) def test_reply_to_extends_to_list(self): eq = self.assertEqual @@ -750,7 +763,11 @@ Reply-To: bperson@dom.ain CookHeaders.process(mlist, msg, msgdata) eq(msgdata['add_header']['Reply-To'], - 'bperson@dom.ain, aperson@dom.ain, _xtest@dom.ain') + 'bperson@dom.ain, _xtest@dom.ain') + eq(msgdata['add_header']['Cc'], + 'aperson@dom.ain') + eq(msg.get_all('reply-to'), ['bperson@dom.ain']) + eq(msg.get_all('cc'), None) def test_reply_to_extends_to_explicit(self): eq = self.assertEqual @@ -784,7 +801,11 @@ Reply-To: bperson@dom.ain msgdata = {} CookHeaders.process(mlist, msg, msgdata) eq(msgdata['add_header']['Reply-To'], - 'mlist@dom.ain, bperson@dom.ain, aperson@dom.ain') + 'mlist@dom.ain, bperson@dom.ain') + eq(msgdata['add_header']['Cc'], + 'aperson@dom.ain') + eq(msg.get_all('reply-to'), ['bperson@dom.ain']) + eq(msg.get_all('cc'), None) def test_list_headers_nolist(self): eq = self.assertEqual @@ -980,7 +1001,8 @@ Content-Transfer-Encoding: 7bit Content-Disposition: inline footer ---BOUNDARY--""") +--BOUNDARY-- +""") def test_image(self): eq = self.assertEqual @@ -1749,7 +1771,8 @@ class TestReplybot(TestBase): class TestSpamDetect(TestBase): def test_short_circuit(self): msgdata = {'approved': 1} - rtn = SpamDetect.process(self._mlist, None, msgdata) + msg = email.message_from_string('') + rtn = SpamDetect.process(self._mlist, msg, msgdata) # Not really a great test, but there's little else to assert self.assertEqual(rtn, None) |