diff options
| author | bwarsaw | 2006-07-08 18:02:57 +0000 |
|---|---|---|
| committer | bwarsaw | 2006-07-08 18:02:57 +0000 |
| commit | c6bd2024ebcb3982bb07c3fed1bb13d7ded332bd (patch) | |
| tree | f94e3945ec69c35be0bad5abeaa71df53b535351 /Mailman/testing/emailbase.py | |
| parent | f321ff8f419284c32f7eea4e06c83212bccef6b0 (diff) | |
| download | mailman-c6bd2024ebcb3982bb07c3fed1bb13d7ded332bd.tar.gz mailman-c6bd2024ebcb3982bb07c3fed1bb13d7ded332bd.tar.zst mailman-c6bd2024ebcb3982bb07c3fed1bb13d7ded332bd.zip | |
Fix some buglets with virtual domain support and repair unit tests broken by
this change. More unit tests should be added.
misc/sitelist.cfg is removed -- this is an ex-site list.
MailList.GetNoReplyEmail() -> MailList.no_reply_address (property)
UserNotification._enqueue(), OwnerNotification._enqueue(): when queing the
message to the virgin queue, be sure to use the fully qualified (i.e. posting)
address for the list.
In the MTA modules, be sure to set up the target of the mail commands as the
fqdn listname because otherwise we can't find the correct list. This needs
some tweaking/testing for Postfix's virtual domain support.
MailList.Load() has to grow an optional argument specifying the fqdn
listname. The problem is that in some situations, we can't calculate that
because we don't know _internal_name, so it has to be passed in. This is
mostly the case in the MailList ctor where a Load hasn't happened yet. For
backward compatibility though, if it's not passed in, just use
mlist.fqdn_listname.
Diffstat (limited to 'Mailman/testing/emailbase.py')
| -rw-r--r-- | Mailman/testing/emailbase.py | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/Mailman/testing/emailbase.py b/Mailman/testing/emailbase.py index 7b80381b4..fa0512e91 100644 --- a/Mailman/testing/emailbase.py +++ b/Mailman/testing/emailbase.py @@ -18,18 +18,15 @@ """Base class for tests that email things.""" import os -import stat import smtpd import socket import asyncore -import tempfile import subprocess from Mailman.configuration import config from Mailman.testing.base import TestBase TESTPORT = 10825 -PERMISSIONS = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH @@ -53,31 +50,28 @@ class SinkServer(smtpd.SMTPServer): class EmailBase(TestBase): - def setUp(self): - # Find an unused non-root requiring port to listen on. Set up a - # configuration file that causes the underlying outgoing runner to use - # the same port, then start Mailman. - fd, self._configfile = tempfile.mkstemp(suffix='.cfg') - fp = os.fdopen(fd, 'w') + def _configure(self, fp): + TestBase._configure(self, fp) print >> fp, 'SMTPPORT =', TESTPORT - config.SMTPPORT = TESTPORT - fp.close() - # Loosen up the permissions - os.chmod(self._configfile, PERMISSIONS) + config.SMTPPORT + + def setUp(self): + TestBase.setUp(self) # Second argument is ignored. self._server = SinkServer(('localhost', TESTPORT), None) - os.system('bin/mailmanctl -C %s -q start' % self._configfile) - # Don't call our superclass's setUp until the above succeeds, - # otherwise, should it fail, we'll be left with a stale _xtest list - # which would have to be manually removed. unittest doesn't call - # tearDown() for errors in setUp(). - TestBase.setUp(self) + try: + os.system('bin/mailmanctl -C %s -q start' % self._config) + # If any errors occur in the above, be sure to manually call + # tearDown(). unittest doesn't call tearDown() for errors in + # setUp(). + except: + self.tearDown() def tearDown(self): - os.system('bin/mailmanctl -C %s -q stop' % self._configfile) + os.system('bin/mailmanctl -C %s -q stop' % self._config) self._server.close() TestBase.tearDown(self) - os.remove(self._configfile) + os.remove(self._config) def _readmsg(self): global MSGTEXT |
