diff options
Diffstat (limited to 'src/mailman/runners/tests')
| -rw-r--r-- | src/mailman/runners/tests/test_archiver.py | 6 | ||||
| -rw-r--r-- | src/mailman/runners/tests/test_bounce.py | 11 | ||||
| -rw-r--r-- | src/mailman/runners/tests/test_confirm.py | 11 | ||||
| -rw-r--r-- | src/mailman/runners/tests/test_lmtp.py | 6 | ||||
| -rw-r--r-- | src/mailman/runners/tests/test_owner.py | 23 | ||||
| -rw-r--r-- | src/mailman/runners/tests/test_pipeline.py | 9 |
6 files changed, 38 insertions, 28 deletions
diff --git a/src/mailman/runners/tests/test_archiver.py b/src/mailman/runners/tests/test_archiver.py index 6f5804cae..30cb9e461 100644 --- a/src/mailman/runners/tests/test_archiver.py +++ b/src/mailman/runners/tests/test_archiver.py @@ -29,7 +29,7 @@ import os import unittest from email import message_from_file -from zope.interface import implements +from zope.interface import implementer from mailman.app.lifecycle import create_list from mailman.config import config @@ -44,8 +44,8 @@ from mailman.utilities.datetime import RFC822_DATE_FMT, factory, now +@implementer(IArchiver) class DummyArchiver: - implements(IArchiver) name = 'dummy' @staticmethod @@ -193,7 +193,7 @@ First post! self.assertEqual(archived['x-original-date'], 'Mon, 01 Aug 2005 07:49:23 +0000') - @configuration('archiver.dummy', + @configuration('archiver.dummy', enable='yes', clobber_date='maybe', clobber_skew='1d') def test_clobber_date_maybe_when_insane(self): # The date is clobbered if it's farther off from now than its skew diff --git a/src/mailman/runners/tests/test_bounce.py b/src/mailman/runners/tests/test_bounce.py index 76eb65c1f..5c21000bf 100644 --- a/src/mailman/runners/tests/test_bounce.py +++ b/src/mailman/runners/tests/test_bounce.py @@ -17,17 +17,20 @@ """Test the bounce runner.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ + 'TestBounceRunner', + 'TestBounceRunnerBug876774', + 'TestStyle', ] import unittest from zope.component import getUtility -from zope.interface import implements +from zope.interface import implementer from mailman.app.bounces import send_probe from mailman.app.lifecycle import create_list @@ -235,8 +238,9 @@ Message-Id: <third> # attributes. In particular, this will not set the bogus `bounce_processing` # attribute which the default style set (before LP: #876774 was fixed). +@implementer(IStyle) class TestStyle: - implements(IStyle) + """See `IStyle`.""" name = 'test' priority = 10 @@ -249,6 +253,7 @@ class TestStyle: styles.append(self) + class TestBounceRunnerBug876774(unittest.TestCase): """Test LP: #876774. diff --git a/src/mailman/runners/tests/test_confirm.py b/src/mailman/runners/tests/test_confirm.py index d2b24a2d1..62171979c 100644 --- a/src/mailman/runners/tests/test_confirm.py +++ b/src/mailman/runners/tests/test_confirm.py @@ -32,6 +32,7 @@ from zope.component import getUtility from mailman.app.lifecycle import create_list from mailman.config import config +from mailman.database.transaction import transaction from mailman.interfaces.registrar import IRegistrar from mailman.interfaces.usermanager import IUserManager from mailman.runners.command import CommandRunner @@ -50,14 +51,14 @@ class TestConfirm(unittest.TestCase): layer = ConfigLayer def setUp(self): - # Register a subscription requiring confirmation. registrar = getUtility(IRegistrar) - self._mlist = create_list('test@example.com') - self._mlist.send_welcome_message = False - self._token = registrar.register(self._mlist, 'anne@example.org') self._commandq = config.switchboards['command'] self._runner = make_testable_runner(CommandRunner, 'command') - config.db.commit() + with transaction(): + # Register a subscription requiring confirmation. + self._mlist = create_list('test@example.com') + self._mlist.send_welcome_message = False + self._token = registrar.register(self._mlist, 'anne@example.org') def test_confirm_with_re_prefix(self): subject = 'Re: confirm {0}'.format(self._token) diff --git a/src/mailman/runners/tests/test_lmtp.py b/src/mailman/runners/tests/test_lmtp.py index 87b69c7e4..46d4ed986 100644 --- a/src/mailman/runners/tests/test_lmtp.py +++ b/src/mailman/runners/tests/test_lmtp.py @@ -31,7 +31,7 @@ import unittest from datetime import datetime from mailman.app.lifecycle import create_list -from mailman.config import config +from mailman.database.transaction import transaction from mailman.testing.helpers import get_lmtp_client, get_queue_messages from mailman.testing.layers import LMTPLayer @@ -43,8 +43,8 @@ class TestLMTP(unittest.TestCase): layer = LMTPLayer def setUp(self): - self._mlist = create_list('test@example.com') - config.db.commit() + with transaction(): + self._mlist = create_list('test@example.com') self._lmtp = get_lmtp_client(quiet=True) self._lmtp.lhlo('remote.example.org') diff --git a/src/mailman/runners/tests/test_owner.py b/src/mailman/runners/tests/test_owner.py index 622bb2255..4ea5771be 100644 --- a/src/mailman/runners/tests/test_owner.py +++ b/src/mailman/runners/tests/test_owner.py @@ -37,6 +37,7 @@ from zope.component import getUtility from mailman.app.lifecycle import create_list from mailman.config import config +from mailman.database.transaction import transaction from mailman.interfaces.member import MemberRole from mailman.interfaces.usermanager import IUserManager from mailman.testing.helpers import ( @@ -59,17 +60,17 @@ class TestEmailToOwner(unittest.TestCase): self._mlist = create_list('test@example.com') # Add some owners, moderators, and members manager = getUtility(IUserManager) - anne = manager.create_address('anne@example.com') - bart = manager.create_address('bart@example.com') - cris = manager.create_address('cris@example.com') - dave = manager.create_address('dave@example.com') - self._mlist.subscribe(anne, MemberRole.member) - self._mlist.subscribe(anne, MemberRole.owner) - self._mlist.subscribe(bart, MemberRole.moderator) - self._mlist.subscribe(bart, MemberRole.owner) - self._mlist.subscribe(cris, MemberRole.moderator) - self._mlist.subscribe(dave, MemberRole.member) - config.db.commit() + with transaction(): + anne = manager.create_address('anne@example.com') + bart = manager.create_address('bart@example.com') + cris = manager.create_address('cris@example.com') + dave = manager.create_address('dave@example.com') + self._mlist.subscribe(anne, MemberRole.member) + self._mlist.subscribe(anne, MemberRole.owner) + self._mlist.subscribe(bart, MemberRole.moderator) + self._mlist.subscribe(bart, MemberRole.owner) + self._mlist.subscribe(cris, MemberRole.moderator) + self._mlist.subscribe(dave, MemberRole.member) self._inq = make_testable_runner(IncomingRunner, 'in') self._pipelineq = make_testable_runner(PipelineRunner, 'pipeline') self._outq = make_testable_runner(OutgoingRunner, 'out') diff --git a/src/mailman/runners/tests/test_pipeline.py b/src/mailman/runners/tests/test_pipeline.py index 8776bf844..3f8f62ab0 100644 --- a/src/mailman/runners/tests/test_pipeline.py +++ b/src/mailman/runners/tests/test_pipeline.py @@ -27,7 +27,7 @@ __all__ = [ import unittest -from zope.interface import implements +from zope.interface import implementer from mailman.app.lifecycle import create_list from mailman.config import config @@ -41,8 +41,10 @@ from mailman.testing.layers import ConfigLayer +@implementer(IHandler) class MyTestHandler: - implements(IHandler) + """See `IHandler`.""" + name = 'test handler' description = 'A test handler' @@ -54,8 +56,9 @@ class MyTestHandler: self._test.mark(self._marker) + +@implementer(IPipeline) class MyTestPipeline: - implements(IPipeline) name = 'test' description = 'a test pipeline' |
