Barry Warsaw pushed to branch rc1 at mailman / Mailman
Commits: 8f176224 by Barry Warsaw at 2017-05-23T15:37:19-07:00 Mock the Mailman version for predictable tests. - - - - - 2 changed files: - src/mailman/handlers/tests/data/msg_rfc822_out.eml - src/mailman/handlers/tests/test_mimedel.py Changes: ===================================== src/mailman/handlers/tests/data/msg_rfc822_out.eml ===================================== --- a/src/mailman/handlers/tests/data/msg_rfc822_out.eml +++ b/src/mailman/handlers/tests/data/msg_rfc822_out.eml @@ -6,7 +6,7 @@ To: Someone <some...@example.net> Subject: Message Subject Content-Type: multipart/mixed; boundary="------------050603050603060608020908" -X-Content-Filtered-By: Mailman/MimeDel 3.1.0b5 +X-Content-Filtered-By: Mailman/MimeDel 123 This is a multi-part message in MIME format. --------------050603050603060608020908 ===================================== src/mailman/handlers/tests/test_mimedel.py ===================================== --- a/src/mailman/handlers/tests/test_mimedel.py +++ b/src/mailman/handlers/tests/test_mimedel.py @@ -38,6 +38,7 @@ from mailman.testing.helpers import ( specialized_message_from_string as mfs) from mailman.testing.layers import ConfigLayer from pkg_resources import resource_filename +from unittest.mock import patch from zope.component import getUtility @@ -224,6 +225,7 @@ class TestMiscellaneous(unittest.TestCase): """Test various miscellaneous filtering actions.""" layer = ConfigLayer + maxDiff = None def setUp(self): self._mlist = create_list('t...@example.com') @@ -256,8 +258,13 @@ multipart/signed with open(email_file) as fp: msg = email.message_from_file(fp) process = config.handlers['mime-delete'].process - process(self._mlist, msg, {}) - with open(email_file2) as fp: + with ExitStack() as resources: + fp = resources.enter_context(open(email_file2)) + # Mock this so that the X-Content-Filtered-By header isn't + # sensitive to Mailman version bumps. + resources.enter_context( + patch('mailman.handlers.mime_delete.VERSION', '123')) + process(self._mlist, msg, {}) self.assertEqual(msg.as_string(), fp.read()) def test_mixed_case_ext_and_recast(self): View it on GitLab: https://gitlab.com/mailman/mailman/commit/8f176224ab767a0c5316e872a758890af7d1feb4 --- View it on GitLab: https://gitlab.com/mailman/mailman/commit/8f176224ab767a0c5316e872a758890af7d1feb4 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org