summaryrefslogtreecommitdiff
path: root/src/mailman/mta
diff options
context:
space:
mode:
authorBarry Warsaw2012-03-06 11:57:17 -0500
committerBarry Warsaw2012-03-06 11:57:17 -0500
commit4ca5055eea7c521e620de8ceeff6fa538b7a0c0b (patch)
tree63f24624049b82974c9302f4663ae1d4d2cd1146 /src/mailman/mta
parente2526bfa5cb3338ac98f101f3020b54c002252dc (diff)
downloadmailman-4ca5055eea7c521e620de8ceeff6fa538b7a0c0b.tar.gz
mailman-4ca5055eea7c521e620de8ceeff6fa538b7a0c0b.tar.zst
mailman-4ca5055eea7c521e620de8ceeff6fa538b7a0c0b.zip
Consistent use of assertMultiLineEqual().
Diffstat (limited to 'src/mailman/mta')
-rw-r--r--src/mailman/mta/tests/test_aliases.py13
-rw-r--r--src/mailman/mta/tests/test_delivery.py10
2 files changed, 8 insertions, 15 deletions
diff --git a/src/mailman/mta/tests/test_aliases.py b/src/mailman/mta/tests/test_aliases.py
index bf77298e6..b1a60bc95 100644
--- a/src/mailman/mta/tests/test_aliases.py
+++ b/src/mailman/mta/tests/test_aliases.py
@@ -127,26 +127,23 @@ class TestPostfix(unittest.TestCase):
"""Test the Postfix LMTP alias generator."""
layer = ConfigLayer
- # For Python 2.7's assertMultiLineEqual
- maxDiff = None
def setUp(self):
self.utility = getUtility(IMailTransportAgentAliases)
self.mlist = create_list('test@example.com')
self.output = StringIO()
self.postfix = LMTP()
- # For Python 2.7's unittest.
+ # Python 2.7 has assertMultiLineEqual. Let this work without bounds.
self.maxDiff = None
+ self.eq = getattr(self, 'assertMultiLineEqual', self.assertEqual)
def test_aliases(self):
# Test the format of the Postfix alias generator.
self.postfix.regenerate(self.output)
- # Python 2.7 has assertMultiLineEqual but Python 2.6 does not.
- eq = getattr(self, 'assertMultiLineEqual', self.assertEqual)
# Strip out the variable and unimportant bits of the output.
lines = self.output.getvalue().splitlines()
output = NL.join(lines[7:])
- eq(output, """\
+ self.eq(output, """\
# Aliases which are visible only in the @example.com domain.
test@example.com lmtp:[127.0.0.1]:9024
test-bounces@example.com lmtp:[127.0.0.1]:9024
@@ -163,13 +160,11 @@ test-unsubscribe@example.com lmtp:[127.0.0.1]:9024
# Both lists need to show up in the aliases file. LP: #874929.
# Create a second list.
create_list('other@example.com')
- # Python 2.7 has assertMultiLineEqual but Python 2.6 does not.
- eq = getattr(self, 'assertMultiLineEqual', self.assertEqual)
self.postfix.regenerate(self.output)
# Strip out the variable and unimportant bits of the output.
lines = self.output.getvalue().splitlines()
output = NL.join(lines[7:])
- eq(output, """\
+ self.eq(output, """\
# Aliases which are visible only in the @example.com domain.
other@example.com lmtp:[127.0.0.1]:9024
other-bounces@example.com lmtp:[127.0.0.1]:9024
diff --git a/src/mailman/mta/tests/test_delivery.py b/src/mailman/mta/tests/test_delivery.py
index 1e362d755..fbac0d121 100644
--- a/src/mailman/mta/tests/test_delivery.py
+++ b/src/mailman/mta/tests/test_delivery.py
@@ -95,6 +95,9 @@ options : $user_optionsurl
template_dir: {0}
""".format(self._template_dir))
self._mlist.footer_uri = 'mailman:///member-footer.txt'
+ # Python 2.7 has assertMultiLineEqual. Let this work without bounds.
+ self.maxDiff = None
+ self.eq = getattr(self, 'assertMultiLineEqual', self.assertEqual)
def tearDown(self):
# Free references.
@@ -121,12 +124,7 @@ options : $user_optionsurl
self.assertEqual(len(refused), 0)
self.assertEqual(len(_deliveries), 1)
_mlist, _msg, _msgdata, _recipients = _deliveries[0]
- try:
- eq = self.assertMultiLineEqual
- except AttributeError:
- # Python 2.6
- eq = self.assertEqual
- eq(_msg.as_string(), """\
+ self.eq(_msg.as_string(), """\
From: anne@example.org
To: test@example.com
Subject: test