diff options
| author | toshio | 2012-03-14 05:30:52 +0000 |
|---|---|---|
| committer | toshio | 2012-03-14 05:30:52 +0000 |
| commit | d1a9979ecf35d05ed115651dcc6b8680af08b954 (patch) | |
| tree | cde5caa9a9c20467b4cb3768b564d08e6a368b1a /src/mailman/testing/layers.py | |
| parent | ccde42a936f6c87032c7afd80f33ca5f3fa00b54 (diff) | |
| parent | bcc42e2201c7172848185e5675a7b79e3d28aa0f (diff) | |
| download | mailman-d1a9979ecf35d05ed115651dcc6b8680af08b954.tar.gz mailman-d1a9979ecf35d05ed115651dcc6b8680af08b954.tar.zst mailman-d1a9979ecf35d05ed115651dcc6b8680af08b954.zip | |
Diffstat (limited to 'src/mailman/testing/layers.py')
| -rw-r--r-- | src/mailman/testing/layers.py | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/mailman/testing/layers.py b/src/mailman/testing/layers.py index 5cee8c8d2..04ab8f91f 100644 --- a/src/mailman/testing/layers.py +++ b/src/mailman/testing/layers.py @@ -22,6 +22,7 @@ from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ 'ConfigLayer', + 'LMTPLayer', 'MockAndMonkeyLayer', 'RESTLayer', 'SMTPLayer', @@ -48,7 +49,8 @@ from mailman.core import initialize from mailman.core.initialize import INHIBIT_CONFIG_FILE from mailman.core.logging import get_handler from mailman.interfaces.domain import IDomainManager -from mailman.testing.helpers import TestableMaster, reset_the_world +from mailman.testing.helpers import ( + TestableMaster, get_lmtp_client, reset_the_world) from mailman.testing.mta import ConnectionCountingController from mailman.utilities.string import expand @@ -250,6 +252,8 @@ class SMTPLayer(ConfigLayer): @classmethod def testSetUp(cls): + # Make sure we don't call our superclass's testSetUp(), otherwise the + # example.com domain will get added twice. pass @classmethod @@ -259,6 +263,35 @@ class SMTPLayer(ConfigLayer): +class LMTPLayer(ConfigLayer): + """Layer for starting, stopping, and accessing a test LMTP server.""" + + lmtpd = None + + @staticmethod + def _wait_for_lmtp_server(): + get_lmtp_client(quiet=True) + + @classmethod + def setUp(cls): + assert cls.lmtpd is None, 'Layer already set up' + cls.lmtpd = TestableMaster(cls._wait_for_lmtp_server) + cls.lmtpd.start('lmtp') + + @classmethod + def tearDown(cls): + assert cls.lmtpd is not None, 'Layer not set up' + cls.lmtpd.stop() + cls.lmtpd = None + + @classmethod + def testSetUp(cls): + # Make sure we don't call our superclass's testSetUp(), otherwise the + # example.com domain will get added twice. + pass + + + class RESTLayer(SMTPLayer): """Layer for starting, stopping, and accessing the test REST layer.""" |
