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 | |
| 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')
| -rw-r--r-- | Mailman/Bouncer.py | 4 | ||||
| -rw-r--r-- | Mailman/Cgi/create.py | 5 | ||||
| -rw-r--r-- | Mailman/Cgi/rmlist.py | 2 | ||||
| -rw-r--r-- | Mailman/Handlers/ToDigest.py | 4 | ||||
| -rw-r--r-- | Mailman/Handlers/ToOutgoing.py | 2 | ||||
| -rw-r--r-- | Mailman/Handlers/ToUsenet.py | 2 | ||||
| -rw-r--r-- | Mailman/MTA/Manual.py | 4 | ||||
| -rw-r--r-- | Mailman/MTA/Postfix.py | 4 | ||||
| -rw-r--r-- | Mailman/MTA/Utils.py | 15 | ||||
| -rw-r--r-- | Mailman/MailList.py | 25 | ||||
| -rw-r--r-- | Mailman/Message.py | 4 | ||||
| -rw-r--r-- | Mailman/Queue/IncomingRunner.py | 2 | ||||
| -rw-r--r-- | Mailman/bin/add_members.py | 2 | ||||
| -rw-r--r-- | Mailman/bin/change_pw.py | 2 | ||||
| -rw-r--r-- | Mailman/bin/newlist.py | 4 | ||||
| -rw-r--r-- | Mailman/testing/base.py | 25 | ||||
| -rw-r--r-- | Mailman/testing/emailbase.py | 36 | ||||
| -rw-r--r-- | Mailman/testing/test_handlers.py | 348 | ||||
| -rw-r--r-- | Mailman/testing/test_message.py | 33 |
19 files changed, 273 insertions, 250 deletions
diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py index 1a5d10a8a..aabe9d5ad 100644 --- a/Mailman/Bouncer.py +++ b/Mailman/Bouncer.py @@ -194,11 +194,11 @@ class Bouncer: 'did' : _('disabled'), 'but' : '', 'reenable' : '', - 'owneraddr': self.GetNoReplyEmail(), + 'owneraddr': self.no_reply_address, }, mlist=self) subject = _('Bounce action notification') umsg = Message.UserNotification(self.GetOwnerEmail(), - self.GetNoReplyEmail(), + self.no_reply_address, subject, lang=self.preferred_language) # BAW: Be sure you set the type before trying to attach, or you'll get diff --git a/Mailman/Cgi/create.py b/Mailman/Cgi/create.py index da66c2f7e..33236ad25 100644 --- a/Mailman/Cgi/create.py +++ b/Mailman/Cgi/create.py @@ -217,7 +217,6 @@ def process_request(doc, cgidata): sys.modules[modname].create(mlist, cgi=True) # And send the notice to the list owner. if notify: - siteowner = mlist.GetNoReplyEmail() text = Utils.maketext( 'newlist.txt', {'listname' : listname, @@ -225,10 +224,10 @@ def process_request(doc, cgidata): 'admin_url' : mlist.GetScriptURL('admin', absolute=True), 'listinfo_url': mlist.GetScriptURL('listinfo', absolute=True), 'requestaddr' : mlist.GetRequestEmail(), - 'siteowner' : siteowner, + 'siteowner' : mlist.no_reply_address, }, mlist=mlist) msg = Message.UserNotification( - owner, siteowner, + owner, mlist.no_reply_address, _('Your new mailing list: $listname'), text, mlist.preferred_language) msg.send(mlist) diff --git a/Mailman/Cgi/rmlist.py b/Mailman/Cgi/rmlist.py index e10e77b6e..78bc5d4f7 100644 --- a/Mailman/Cgi/rmlist.py +++ b/Mailman/Cgi/rmlist.py @@ -168,7 +168,7 @@ def process_request(doc, cgidata, mlist): table.AddRow([_('''You have successfully deleted the mailing list <b>%(listname)s</b>.''')]) else: - sitelist = mlist.GetNoReplyEmail() + sitelist = mlist.no_reply_address table.AddRow([_('''There were some problems deleting the mailing list <b>%(listname)s</b>. Contact your site administrator at %(sitelist)s for details.''')]) diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index 9d8cc1af0..f759e82c8 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -398,11 +398,11 @@ def send_i18n_digests(mlist, mboxfp): # MIME virginq.enqueue(mimemsg, recips=mimerecips, - listname=mlist.internal_name(), + listname=mlist.fqdn_listname, isdigest=True) # RFC 1153 rfc1153msg.set_payload(plainmsg.getvalue(), lcset) virginq.enqueue(rfc1153msg, recips=plainrecips, - listname=mlist.internal_name(), + listname=mlist.fqdn_listname, isdigest=True) diff --git a/Mailman/Handlers/ToOutgoing.py b/Mailman/Handlers/ToOutgoing.py index c29f83f76..cc266c130 100644 --- a/Mailman/Handlers/ToOutgoing.py +++ b/Mailman/Handlers/ToOutgoing.py @@ -53,4 +53,4 @@ def process(mlist, msg, msgdata): msgdata['verp'] = not (int(mlist.post_id) % interval) # And now drop the message in qfiles/out outq = get_switchboard(config.OUTQUEUE_DIR) - outq.enqueue(msg, msgdata, listname=mlist.internal_name()) + outq.enqueue(msg, msgdata, listname=mlist.fqdn_listname) diff --git a/Mailman/Handlers/ToUsenet.py b/Mailman/Handlers/ToUsenet.py index 5ca926164..8edb471d2 100644 --- a/Mailman/Handlers/ToUsenet.py +++ b/Mailman/Handlers/ToUsenet.py @@ -46,4 +46,4 @@ def process(mlist, msg, msgdata): return # Put the message in the news runner's queue newsq = get_switchboard(config.NEWSQUEUE_DIR) - newsq.enqueue(msg, msgdata, listname=mlist.internal_name()) + newsq.enqueue(msg, msgdata, listname=mlist.fqdn_listname) diff --git a/Mailman/MTA/Manual.py b/Mailman/MTA/Manual.py index 4a3d6aec4..d49327765 100644 --- a/Mailman/MTA/Manual.py +++ b/Mailman/MTA/Manual.py @@ -78,7 +78,7 @@ equivalent) file by adding the following lines, and possibly running the ## %(listname)s mailing list""") outfp = sys.stdout # Common path - for k, v in makealiases(listname): + for k, v in makealiases(mlist): print >> outfp, k + ':', ((fieldsz - len(k)) * ' '), v # If we're using the command line interface, we're done. For ttw, we need # to actually send the message to mailman-owner now. @@ -121,7 +121,7 @@ equivalent) file by removing the following lines, and possibly running the ## %(listname)s mailing list""") outfp = sys.stdout # Common path - for k, v in makealiases(listname): + for k, v in makealiases(mlist): print >> outfp, k + ':', ((fieldsz - len(k)) * ' '), v # If we're using the command line interface, we're done. For ttw, we need # to actually send the message to mailman-owner now. diff --git a/Mailman/MTA/Postfix.py b/Mailman/MTA/Postfix.py index 4301321e7..9f7b52d50 100644 --- a/Mailman/MTA/Postfix.py +++ b/Mailman/MTA/Postfix.py @@ -118,7 +118,7 @@ def _addvirtual(mlist, fp): fieldsz = len(listname) + len('-unsubscribe') hostname = mlist.host_name # Set up the mailman-loop address - loopaddr = mlist.GetNoReplyEmail() + loopaddr = mlist.no_reply_address loopdest = Utils.ParseEmail(loopaddr)[0] # Seek to the end of the text file, but if it's empty write the standard # disclaimer, and the loop catch address. @@ -152,7 +152,7 @@ def _addvirtual(mlist, fp): # Blech. def _check_for_virtual_loopaddr(mlist, filename): - loopaddr = mlist.GetNoReplyEmail() + loopaddr = mlist.no_reply_address loopdest = Utils.ParseEmail(loopaddr)[0] infp = open(filename) omask = os.umask(007) diff --git a/Mailman/MTA/Utils.py b/Mailman/MTA/Utils.py index ef3df0cb8..cc26fae11 100644 --- a/Mailman/MTA/Utils.py +++ b/Mailman/MTA/Utils.py @@ -35,7 +35,7 @@ def getusername(): -def _makealiases_mailprog(listname): +def _makealiases_mailprog(mlist): wrapper = os.path.join(config.WRAPPER_DIR, 'mailman') # Most of the list alias extensions are quite regular. I.e. if the # message is delivered to listname-foobar, it will be filtered to a @@ -47,18 +47,23 @@ def _makealiases_mailprog(listname): # need for the -admin address anymore). # # Seed this with the special cases. - aliases = [(listname, '"|%s post %s"' % (wrapper, listname)), - ] + listname = mlist.internal_name() + fqdn_listname = mlist.fqdn_listname + aliases = [ + (listname, '"|%s post %s"' % (wrapper, fqdn_listname)), + ] for ext in ('admin', 'bounces', 'confirm', 'join', 'leave', 'owner', 'request', 'subscribe', 'unsubscribe'): aliases.append(('%s-%s' % (listname, ext), - '"|%s %s %s"' % (wrapper, ext, listname))) + '"|%s %s %s"' % (wrapper, ext, fqdn_listname))) return aliases -def _makealiases_maildir(listname): +def _makealiases_maildir(mlist): maildir = config.MAILDIR_DIR + listname = mlist.internal_name() + fqdn_listname = mlist.fqdn_listname if not maildir.endswith('/'): maildir += '/' # Deliver everything using maildir style. This way there's no mail diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 069a0b397..de43887ef 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -125,7 +125,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, # This will load the database. self.Lock() else: - self.Load() + self.Load(name) def __getattr__(self, name): # Because we're using delegation, we want to be sure that attribute @@ -160,7 +160,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, # Must reload our database for consistency. Watch out for lists that # don't exist. try: - self.Load() + self.Load(self.fqdn_listname) except Exception: self.Unlock() raise @@ -186,6 +186,10 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, def fqdn_listname(self): return '%s@%s' % (self._internal_name, self.host_name) + @property + def no_reply_address(self): + return '%s@%s' % (config.NO_REPLY_ADDRESS, self.host_name) + def getListAddress(self, extra=None): if extra is None: return self.fqdn_listname @@ -198,9 +202,6 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, def GetOwnerEmail(self): return self.getListAddress('owner') - def GetNoReplyEmail(self): - return '%s@%s' % (config.NO_REPLY_ADDRESS, self.host_name) - def GetRequestEmail(self, cookie=''): if config.VERP_CONFIRMATIONS and cookie: return self.GetConfirmEmail(cookie) @@ -277,7 +278,11 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, self.__lock = LockFile.LockFile( os.path.join(config.LOCK_DIR, name or '<site>') + '.lock', lifetime=config.LIST_LOCK_LIFETIME) - self._internal_name = name + # XXX FIXME Sometimes name is fully qualified, sometimes it's not. + if name and '@' in name: + self._internal_name, email_host = name.split('@', 1) + else: + self._internal_name = name if name: self._full_path = os.path.join(config.LIST_DATA_DIR, name) else: @@ -621,8 +626,10 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, self.__timestamp = mtime return d, None - def Load(self, check_version=True): - if not Utils.list_exists(self.internal_name()): + def Load(self, fqdn_listname=None, check_version=True): + if fqdn_listname is None: + fqdn_listname = self.fqdn_listname + if not Utils.list_exists(fqdn_listname): raise Errors.MMUnknownListError # We first try to load config.pck, which contains the up-to-date # version of the database. If that fails, perhaps because it's @@ -717,7 +724,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, # Then reload the database (but don't recurse). Force a reload even # if we have the most up-to-date state. self.__timestamp = 0 - self.Load(check_version=0) + self.Load(self.fqdn_listname, check_version=False) # We must hold the list lock in order to update the schema waslocked = self.Locked() if not waslocked: diff --git a/Mailman/Message.py b/Mailman/Message.py index acad25680..a8a58ae96 100644 --- a/Mailman/Message.py +++ b/Mailman/Message.py @@ -248,7 +248,7 @@ class UserNotification(Message): virginq = get_switchboard(config.VIRGINQUEUE_DIR) # The message metadata better have a `recip' attribute virginq.enqueue(self, - listname=mlist.internal_name(), + listname=mlist.fqdn_listname, recips=self.recips, nodecorate=True, reduced_list_headers=True, @@ -277,7 +277,7 @@ class OwnerNotification(UserNotification): virginq = get_switchboard(config.VIRGINQUEUE_DIR) # The message metadata better have a `recip' attribute virginq.enqueue(self, - listname=mlist.internal_name(), + listname=mlist.fqdn_listname, recips=self.recips, nodecorate=True, reduced_list_headers=True, diff --git a/Mailman/Queue/IncomingRunner.py b/Mailman/Queue/IncomingRunner.py index efd7072d8..e0dcd01a4 100644 --- a/Mailman/Queue/IncomingRunner.py +++ b/Mailman/Queue/IncomingRunner.py @@ -116,7 +116,7 @@ class IncomingRunner(Runner): def _dispose(self, mlist, msg, msgdata): if msgdata.get('envsender') is None: - msg['envsender'] = mlist.GetNoReplyEmail() + msg['envsender'] = mlist.no_reply_address # Try to get the list lock. try: mlist.Lock(timeout=config.LIST_LOCK_TIMEOUT) diff --git a/Mailman/bin/add_members.py b/Mailman/bin/add_members.py index 932e4f77d..2c0ffa868 100644 --- a/Mailman/bin/add_members.py +++ b/Mailman/bin/add_members.py @@ -202,7 +202,7 @@ def main(): if admin_notify: subject = _('$mlist.real_name subscription notification') msg = Message.UserNotification( - mlist.owner, mlist.GetNoReplyEmail(), subject, s.getvalue(), + mlist.owner, mlist.no_reply_address, subject, s.getvalue(), mlist.preferred_language) msg.send(mlist) diff --git a/Mailman/bin/change_pw.py b/Mailman/bin/change_pw.py index 6c2beaf13..d77dd9787 100644 --- a/Mailman/bin/change_pw.py +++ b/Mailman/bin/change_pw.py @@ -155,7 +155,7 @@ def main(): hostname = mlist.host_name adminurl = mlist.GetScriptURL('admin', absolute=True) msg = Message.UserNotification( - mlist.owner[:], mlist.GetNoReplyEmail(), + mlist.owner[:], mlist.no_reply_address, _('Your new $listname list password'), _('''\ The site administrator at $hostname has changed the password for your diff --git a/Mailman/bin/newlist.py b/Mailman/bin/newlist.py index 3136ef425..461cd9ee6 100644 --- a/Mailman/bin/newlist.py +++ b/Mailman/bin/newlist.py @@ -189,7 +189,7 @@ def main(): admin_url = mlist.GetScriptURL('admin', absolute=True), listinfo_url = mlist.GetScriptURL('listinfo', absolute=True), requestaddr = mlist.GetRequestEmail(), - siteowner = mlist.GetNoReplyEmail(), + siteowner = mlist.no_reply_address, ) text = Utils.maketext('newlist.txt', d, mlist=mlist) # Set the I18N language to the list's preferred language so the header @@ -199,7 +199,7 @@ def main(): i18n.set_language(mlist.preferred_language) try: msg = Message.UserNotification( - owner_mail, mlist.GetNoReplyEmail(), + owner_mail, mlist.no_reply_address, _('Your new mailing list: $listname'), text, mlist.preferred_language) msg.send(mlist) diff --git a/Mailman/testing/base.py b/Mailman/testing/base.py index 76c7243af..589ab0abb 100644 --- a/Mailman/testing/base.py +++ b/Mailman/testing/base.py @@ -18,8 +18,10 @@ """Test base class which handles creating and deleting a test list.""" import os +import stat import shutil import difflib +import tempfile import unittest from cStringIO import StringIO @@ -29,10 +31,17 @@ from Mailman import Utils from Mailman.configuration import config NL = '\n' +PERMISSIONS = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH class TestBase(unittest.TestCase): + def _configure(self, fp): + print >> fp, 'add_domain("example.com", "www.example.com")' + # Only add this domain once to the current process + if 'example.com' not in config.domains: + config.add_domain('example.com', 'www.example.com') + def ndiffAssertEqual(self, first, second): """Like failUnlessEqual except use ndiff for readable output.""" if first <> second: @@ -44,17 +53,25 @@ class TestBase(unittest.TestCase): raise self.failureException(fp.getvalue()) def setUp(self): + # Write a temporary configuration file, but allow for subclasses to + # add additional data. + fd, self._config = tempfile.mkstemp(suffix='.cfg') + os.close(fd) + fp = open(self._config, 'w') + try: + self._configure(fp) + finally: + fp.close() + os.chmod(self._config, PERMISSIONS) mlist = MailList.MailList() - mlist.Create('_xtest', 'test@dom.ain', 'xxxxx') - mlist.host_name = 'dom.ain' - mlist.web_page_url = 'http://www.dom.ain/mailman/' + mlist.Create('_xtest@example.com', 'owner@example.com', 'xxxxx') mlist.Save() # This leaves the list in a locked state self._mlist = mlist def tearDown(self): self._mlist.Unlock() - listname = self._mlist.internal_name() + listname = self._mlist.fqdn_listname for dirtmpl in ['lists/%s', 'archives/private/%s', 'archives/private/%s.mbox', 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 diff --git a/Mailman/testing/test_handlers.py b/Mailman/testing/test_handlers.py index 630d08286..1c38daa8b 100644 --- a/Mailman/testing/test_handlers.py +++ b/Mailman/testing/test_handlers.py @@ -68,7 +68,7 @@ class TestAcknowledge(TestBase): # We're going to want to inspect this queue directory self._sb = Switchboard(config.VIRGINQUEUE_DIR) # Add a member - self._mlist.addNewMember('aperson@dom.ain') + self._mlist.addNewMember('aperson@example.org') self._mlist.personalize = False def tearDown(self): @@ -81,11 +81,11 @@ class TestAcknowledge(TestBase): # Make sure there are no files in the virgin queue already eq(len(self._sb.files()), 0) msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) Acknowledge.process(self._mlist, msg, - {'original_sender': 'aperson@dom.ain'}) + {'original_sender': 'aperson@example.org'}) eq(len(self._sb.files()), 0) def test_no_ack_not_a_member(self): @@ -93,18 +93,18 @@ From: aperson@dom.ain # Make sure there are no files in the virgin queue already eq(len(self._sb.files()), 0) msg = email.message_from_string("""\ -From: bperson@dom.ain +From: bperson@example.com """, Message.Message) Acknowledge.process(self._mlist, msg, - {'original_sender': 'bperson@dom.ain'}) + {'original_sender': 'bperson@example.com'}) eq(len(self._sb.files()), 0) def test_no_ack_sender(self): eq = self.assertEqual eq(len(self._sb.files()), 0) msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) Acknowledge.process(self._mlist, msg, {}) @@ -113,10 +113,10 @@ From: aperson@dom.ain def test_ack_no_subject(self): eq = self.assertEqual self._mlist.setMemberOption( - 'aperson@dom.ain', config.AcknowledgePosts, 1) + 'aperson@example.org', config.AcknowledgePosts, 1) eq(len(self._sb.files()), 0) msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) Acknowledge.process(self._mlist, msg, {}) @@ -124,18 +124,18 @@ From: aperson@dom.ain eq(len(files), 1) qmsg, qdata = self._sb.dequeue(files[0]) # Check the .db file - eq(qdata.get('listname'), '_xtest') - eq(qdata.get('recips'), ['aperson@dom.ain']) + eq(qdata.get('listname'), '_xtest@example.com') + eq(qdata.get('recips'), ['aperson@example.org']) eq(qdata.get('version'), 3) # Check the .pck eq(str(str(qmsg['subject'])), '_xtest post acknowledgement') - eq(qmsg['to'], 'aperson@dom.ain') - eq(qmsg['from'], '_xtest-bounces@dom.ain') + eq(qmsg['to'], 'aperson@example.org') + eq(qmsg['from'], '_xtest-bounces@example.com') eq(qmsg.get_type(), 'text/plain') eq(qmsg.get_param('charset'), 'us-ascii') msgid = qmsg['message-id'] self.failUnless(msgid.startswith('<mailman.')) - self.failUnless(msgid.endswith('._xtest@dom.ain>')) + self.failUnless(msgid.endswith('._xtest@example.com>')) eq(qmsg.get_payload(), """\ Your message entitled @@ -143,8 +143,8 @@ Your message entitled was successfully received by the _xtest mailing list. -List info page: http://www.dom.ain/mailman/listinfo/_xtest -Your preferences: http://www.dom.ain/mailman/options/_xtest/aperson%40dom.ain +List info page: http://www.example.com/mailman/listinfo/_xtest +Your preferences: http://www.example.com/mailman/options/_xtest/aperson%40example.org """) # Make sure we dequeued the only message eq(len(self._sb.files()), 0) @@ -152,10 +152,10 @@ Your preferences: http://www.dom.ain/mailman/options/_xtest/aperson%40dom.ain def test_ack_with_subject(self): eq = self.assertEqual self._mlist.setMemberOption( - 'aperson@dom.ain', config.AcknowledgePosts, 1) + 'aperson@example.org', config.AcknowledgePosts, 1) eq(len(self._sb.files()), 0) msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Subject: Wish you were here """, Message.Message) @@ -164,18 +164,18 @@ Subject: Wish you were here eq(len(files), 1) qmsg, qdata = self._sb.dequeue(files[0]) # Check the .db file - eq(qdata.get('listname'), '_xtest') - eq(qdata.get('recips'), ['aperson@dom.ain']) + eq(qdata.get('listname'), '_xtest@example.com') + eq(qdata.get('recips'), ['aperson@example.org']) eq(qdata.get('version'), 3) # Check the .pck eq(str(qmsg['subject']), '_xtest post acknowledgement') - eq(qmsg['to'], 'aperson@dom.ain') - eq(qmsg['from'], '_xtest-bounces@dom.ain') + eq(qmsg['to'], 'aperson@example.org') + eq(qmsg['from'], '_xtest-bounces@example.com') eq(qmsg.get_type(), 'text/plain') eq(qmsg.get_param('charset'), 'us-ascii') msgid = qmsg['message-id'] self.failUnless(msgid.startswith('<mailman.')) - self.failUnless(msgid.endswith('._xtest@dom.ain>')) + self.failUnless(msgid.endswith('._xtest@example.com>')) eq(qmsg.get_payload(), """\ Your message entitled @@ -183,8 +183,8 @@ Your message entitled was successfully received by the _xtest mailing list. -List info page: http://www.dom.ain/mailman/listinfo/_xtest -Your preferences: http://www.dom.ain/mailman/options/_xtest/aperson%40dom.ain +List info page: http://www.example.com/mailman/listinfo/_xtest +Your preferences: http://www.example.com/mailman/options/_xtest/aperson%40example.org """) # Make sure we dequeued the only message eq(len(self._sb.files()), 0) @@ -284,13 +284,13 @@ class TestCalcRecips(TestBase): TestBase.setUp(self) # Add a bunch of regular members mlist = self._mlist - mlist.addNewMember('aperson@dom.ain') - mlist.addNewMember('bperson@dom.ain') - mlist.addNewMember('cperson@dom.ain') + mlist.addNewMember('aperson@example.org') + mlist.addNewMember('bperson@example.com') + mlist.addNewMember('cperson@example.com') # And a bunch of digest members - mlist.addNewMember('dperson@dom.ain', digest=1) - mlist.addNewMember('eperson@dom.ain', digest=1) - mlist.addNewMember('fperson@dom.ain', digest=1) + mlist.addNewMember('dperson@example.com', digest=1) + mlist.addNewMember('eperson@example.com', digest=1) + mlist.addNewMember('fperson@example.com', digest=1) def test_short_circuit(self): msgdata = {'recips': 1} @@ -301,35 +301,35 @@ class TestCalcRecips(TestBase): def test_simple_path(self): msgdata = {} msg = email.message_from_string("""\ -From: dperson@dom.ain +From: dperson@example.com """, Message.Message) CalcRecips.process(self._mlist, msg, msgdata) self.failUnless(msgdata.has_key('recips')) recips = msgdata['recips'] recips.sort() - self.assertEqual(recips, ['aperson@dom.ain', 'bperson@dom.ain', - 'cperson@dom.ain']) + self.assertEqual(recips, ['aperson@example.org', 'bperson@example.com', + 'cperson@example.com']) def test_exclude_sender(self): msgdata = {} msg = email.message_from_string("""\ -From: cperson@dom.ain +From: cperson@example.com """, Message.Message) - self._mlist.setMemberOption('cperson@dom.ain', + self._mlist.setMemberOption('cperson@example.com', config.DontReceiveOwnPosts, 1) CalcRecips.process(self._mlist, msg, msgdata) self.failUnless(msgdata.has_key('recips')) recips = msgdata['recips'] recips.sort() - self.assertEqual(recips, ['aperson@dom.ain', 'bperson@dom.ain']) + self.assertEqual(recips, ['aperson@example.org', 'bperson@example.com']) def test_urgent_moderator(self): self._mlist.mod_password = password('xxXXxx') msgdata = {} msg = email.message_from_string("""\ -From: dperson@dom.ain +From: dperson@example.com Urgent: xxXXxx """, Message.Message) @@ -337,16 +337,16 @@ Urgent: xxXXxx self.failUnless(msgdata.has_key('recips')) recips = msgdata['recips'] recips.sort() - self.assertEqual(recips, ['aperson@dom.ain', 'bperson@dom.ain', - 'cperson@dom.ain', 'dperson@dom.ain', - 'eperson@dom.ain', 'fperson@dom.ain']) + self.assertEqual(recips, ['aperson@example.org', 'bperson@example.com', + 'cperson@example.com', 'dperson@example.com', + 'eperson@example.com', 'fperson@example.com']) def test_urgent_admin(self): self._mlist.mod_password = password('yyYYyy') self._mlist.password = password('xxXXxx') msgdata = {} msg = email.message_from_string("""\ -From: dperson@dom.ain +From: dperson@example.com Urgent: xxXXxx """, Message.Message) @@ -354,16 +354,16 @@ Urgent: xxXXxx self.failUnless(msgdata.has_key('recips')) recips = msgdata['recips'] recips.sort() - self.assertEqual(recips, ['aperson@dom.ain', 'bperson@dom.ain', - 'cperson@dom.ain', 'dperson@dom.ain', - 'eperson@dom.ain', 'fperson@dom.ain']) + self.assertEqual(recips, ['aperson@example.org', 'bperson@example.com', + 'cperson@example.com', 'dperson@example.com', + 'eperson@example.com', 'fperson@example.com']) def test_urgent_reject(self): self._mlist.mod_password = password('yyYYyy') self._mlist.password = password('xxXXxx') msgdata = {} msg = email.message_from_string("""\ -From: dperson@dom.ain +From: dperson@example.com Urgent: zzZZzz """, Message.Message) @@ -382,15 +382,15 @@ class TestCleanse(TestBase): def test_simple_cleanse(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Approved: yes Urgent: indeed -Reply-To: bperson@dom.ain -Sender: asystem@dom.ain -Return-Receipt-To: another@dom.ain -Disposition-Notification-To: athird@dom.ain -X-Confirm-Reading-To: afourth@dom.ain -X-PMRQC: afifth@dom.ain +Reply-To: bperson@example.com +Sender: asystem@example.com +Return-Receipt-To: another@example.com +Disposition-Notification-To: athird@example.com +X-Confirm-Reading-To: afourth@example.com +X-PMRQC: afifth@example.com Subject: a message to you """, Message.Message) @@ -401,23 +401,23 @@ Subject: a message to you eq(msg['disposition-notification-to'], None) eq(msg['x-confirm-reading-to'], None) eq(msg['x-pmrqc'], None) - eq(msg['from'], 'aperson@dom.ain') - eq(msg['reply-to'], 'bperson@dom.ain') - eq(msg['sender'], 'asystem@dom.ain') + eq(msg['from'], 'aperson@example.org') + eq(msg['reply-to'], 'bperson@example.com') + eq(msg['sender'], 'asystem@example.com') eq(msg['subject'], 'a message to you') def test_anon_cleanse(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Approved: yes Urgent: indeed -Reply-To: bperson@dom.ain -Sender: asystem@dom.ain -Return-Receipt-To: another@dom.ain -Disposition-Notification-To: athird@dom.ain -X-Confirm-Reading-To: afourth@dom.ain -X-PMRQC: afifth@dom.ain +Reply-To: bperson@example.com +Sender: asystem@example.com +Return-Receipt-To: another@example.com +Disposition-Notification-To: athird@example.com +X-Confirm-Reading-To: afourth@example.com +X-PMRQC: afifth@example.com Subject: a message to you """, Message.Message) @@ -431,8 +431,8 @@ Subject: a message to you eq(msg['x-pmrqc'], None) eq(len(msg.get_all('from')), 1) eq(len(msg.get_all('reply-to')), 1) - eq(msg['from'], '_xtest@dom.ain') - eq(msg['reply-to'], '_xtest@dom.ain') + eq(msg['from'], '_xtest@example.com') + eq(msg['reply-to'], '_xtest@example.com') eq(msg['sender'], None) eq(msg['subject'], 'a message to you') @@ -451,12 +451,12 @@ X-Ack: yes def test_original_sender(self): msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) msgdata = {} CookHeaders.process(self._mlist, msg, msgdata) - self.assertEqual(msgdata.get('original_sender'), 'aperson@dom.ain') + self.assertEqual(msgdata.get('original_sender'), 'aperson@example.org') def test_no_original_sender(self): msg = email.message_from_string("""\ @@ -469,29 +469,29 @@ Subject: about this message def test_xbeenthere(self): msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) CookHeaders.process(self._mlist, msg, {}) - self.assertEqual(msg['x-beenthere'], '_xtest@dom.ain') + self.assertEqual(msg['x-beenthere'], '_xtest@example.com') def test_multiple_xbeentheres(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain -X-BeenThere: alist@another.dom.ain +From: aperson@example.org +X-BeenThere: alist@another.example.com """, Message.Message) CookHeaders.process(self._mlist, msg, {}) eq(len(msg.get_all('x-beenthere')), 2) beentheres = msg.get_all('x-beenthere') beentheres.sort() - eq(beentheres, ['_xtest@dom.ain', 'alist@another.dom.ain']) + eq(beentheres, ['_xtest@example.com', 'alist@another.example.com']) def test_nonexisting_mmversion(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) CookHeaders.process(self._mlist, msg, {}) @@ -500,7 +500,7 @@ From: aperson@dom.ain def test_existing_mmversion(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org X-Mailman-Version: 3000 """, Message.Message) @@ -511,7 +511,7 @@ X-Mailman-Version: 3000 def test_nonexisting_precedence(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) CookHeaders.process(self._mlist, msg, {}) @@ -520,7 +520,7 @@ From: aperson@dom.ain def test_existing_precedence(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Precedence: junk """, Message.Message) @@ -531,7 +531,7 @@ Precedence: junk def test_subject_munging_no_subject(self): self._mlist.subject_prefix = '[XTEST] ' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) msgdata = {} @@ -542,7 +542,7 @@ From: aperson@dom.ain def test_subject_munging(self): self._mlist.subject_prefix = '[XTEST] ' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Subject: About Mailman... """, Message.Message) @@ -552,7 +552,7 @@ Subject: About Mailman... def test_no_subject_munging_for_digests(self): self._mlist.subject_prefix = '[XTEST] ' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Subject: About Mailman... """, Message.Message) @@ -562,7 +562,7 @@ Subject: About Mailman... def test_no_subject_munging_for_fasttrack(self): self._mlist.subject_prefix = '[XTEST] ' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Subject: About Mailman... """, Message.Message) @@ -572,7 +572,7 @@ Subject: About Mailman... def test_no_subject_munging_has_prefix(self): self._mlist.subject_prefix = '[XTEST] ' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Subject: Re: [XTEST] About Mailman... """, Message.Message) @@ -584,12 +584,12 @@ Subject: Re: [XTEST] About Mailman... mlist = self._mlist mlist.reply_goes_to_list = 1 msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], '_xtest@dom.ain') - eq(msg.get_all('reply-to'), ['_xtest@dom.ain']) + eq(msg['reply-to'], '_xtest@example.com') + eq(msg.get_all('reply-to'), ['_xtest@example.com']) def test_reply_to_list_with_strip(self): eq = self.assertEqual @@ -597,41 +597,41 @@ From: aperson@dom.ain mlist.reply_goes_to_list = 1 mlist.first_strip_reply_to = 1 msg = email.message_from_string("""\ -From: aperson@dom.ain -Reply-To: bperson@dom.ain +From: aperson@example.org +Reply-To: bperson@example.com """, Message.Message) CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], '_xtest@dom.ain') - eq(msg.get_all('reply-to'), ['_xtest@dom.ain']) + eq(msg['reply-to'], '_xtest@example.com') + eq(msg.get_all('reply-to'), ['_xtest@example.com']) def test_reply_to_explicit(self): eq = self.assertEqual mlist = self._mlist mlist.reply_goes_to_list = 2 - mlist.reply_to_address = 'mlist@dom.ain' + mlist.reply_to_address = 'mlist@example.com' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], 'mlist@dom.ain') - eq(msg.get_all('reply-to'), ['mlist@dom.ain']) + eq(msg['reply-to'], 'mlist@example.com') + eq(msg.get_all('reply-to'), ['mlist@example.com']) def test_reply_to_explicit_with_strip(self): eq = self.assertEqual mlist = self._mlist mlist.reply_goes_to_list = 2 mlist.first_strip_reply_to = 1 - mlist.reply_to_address = 'mlist@dom.ain' + mlist.reply_to_address = 'mlist@example.com' msg = email.message_from_string("""\ -From: aperson@dom.ain -Reply-To: bperson@dom.ain +From: aperson@example.org +Reply-To: bperson@example.com """, Message.Message) CookHeaders.process(self._mlist, msg, {}) - eq(msg['reply-to'], 'mlist@dom.ain') - eq(msg.get_all('reply-to'), ['mlist@dom.ain']) + eq(msg['reply-to'], 'mlist@example.com') + eq(msg.get_all('reply-to'), ['mlist@example.com']) def test_reply_to_extends_to_list(self): eq = self.assertEqual @@ -639,31 +639,31 @@ Reply-To: bperson@dom.ain mlist.reply_goes_to_list = 1 mlist.first_strip_reply_to = 0 msg = email.message_from_string("""\ -From: aperson@dom.ain -Reply-To: bperson@dom.ain +From: aperson@example.org +Reply-To: bperson@example.com """, Message.Message) CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], 'bperson@dom.ain, _xtest@dom.ain') + eq(msg['reply-to'], 'bperson@example.com, _xtest@example.com') def test_reply_to_extends_to_explicit(self): eq = self.assertEqual mlist = self._mlist mlist.reply_goes_to_list = 2 mlist.first_strip_reply_to = 0 - mlist.reply_to_address = 'mlist@dom.ain' + mlist.reply_to_address = 'mlist@example.com' msg = email.message_from_string("""\ -From: aperson@dom.ain -Reply-To: bperson@dom.ain +From: aperson@example.org +Reply-To: bperson@example.com """, Message.Message) CookHeaders.process(mlist, msg, {}) - eq(msg['reply-to'], 'mlist@dom.ain, bperson@dom.ain') + eq(msg['reply-to'], 'mlist@example.com, bperson@example.com') def test_list_headers_nolist(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) CookHeaders.process(self._mlist, msg, {'_nolist': 1}) @@ -678,44 +678,44 @@ From: aperson@dom.ain eq = self.assertEqual self._mlist.archive = 1 msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) oldval = config.DEFAULT_URL_HOST - config.DEFAULT_URL_HOST = 'www.dom.ain' + config.DEFAULT_URL_HOST = 'www.example.com' try: CookHeaders.process(self._mlist, msg, {}) finally: config.DEFAULT_URL_HOST = oldval - eq(msg['list-id'], '<_xtest.dom.ain>') - eq(msg['list-help'], '<mailto:_xtest-request@dom.ain?subject=help>') + eq(msg['list-id'], '<_xtest.example.com>') + eq(msg['list-help'], '<mailto:_xtest-request@example.com?subject=help>') eq(msg['list-unsubscribe'], - '<http://www.dom.ain/mailman/listinfo/_xtest>,' - '\n\t<mailto:_xtest-request@dom.ain?subject=unsubscribe>') + '<http://www.example.com/mailman/listinfo/_xtest>,' + '\n\t<mailto:_xtest-request@example.com?subject=unsubscribe>') eq(msg['list-subscribe'], - '<http://www.dom.ain/mailman/listinfo/_xtest>,' - '\n\t<mailto:_xtest-request@dom.ain?subject=subscribe>') - eq(msg['list-post'], '<mailto:_xtest@dom.ain>') - eq(msg['list-archive'], '<http://www.dom.ain/pipermail/_xtest>') + '<http://www.example.com/mailman/listinfo/_xtest>,' + '\n\t<mailto:_xtest-request@example.com?subject=subscribe>') + eq(msg['list-post'], '<mailto:_xtest@example.com>') + eq(msg['list-archive'], '<http://www.example.com/pipermail/_xtest>') def test_list_headers_with_description(self): eq = self.assertEqual self._mlist.archive = 1 self._mlist.description = 'A Test List' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) CookHeaders.process(self._mlist, msg, {}) - eq(unicode(msg['list-id']), u'A Test List <_xtest.dom.ain>') - eq(msg['list-help'], '<mailto:_xtest-request@dom.ain?subject=help>') + eq(unicode(msg['list-id']), u'A Test List <_xtest.example.com>') + eq(msg['list-help'], '<mailto:_xtest-request@example.com?subject=help>') eq(msg['list-unsubscribe'], - '<http://www.dom.ain/mailman/listinfo/_xtest>,' - '\n\t<mailto:_xtest-request@dom.ain?subject=unsubscribe>') + '<http://www.example.com/mailman/listinfo/_xtest>,' + '\n\t<mailto:_xtest-request@example.com?subject=unsubscribe>') eq(msg['list-subscribe'], - '<http://www.dom.ain/mailman/listinfo/_xtest>,' - '\n\t<mailto:_xtest-request@dom.ain?subject=subscribe>') - eq(msg['list-post'], '<mailto:_xtest@dom.ain>') + '<http://www.example.com/mailman/listinfo/_xtest>,' + '\n\t<mailto:_xtest-request@example.com?subject=subscribe>') + eq(msg['list-post'], '<mailto:_xtest@example.com>') @@ -731,7 +731,7 @@ class TestDecorate(TestBase): mlist.msg_header = 'header\n' mlist.msg_footer = 'footer' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Here is a message. """) @@ -747,7 +747,7 @@ footer""") mlist.msg_footer = '%(real_name)s footer' mlist.real_name = 'XTest' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Here is a message. """) @@ -763,7 +763,7 @@ XTest footer""") mlist.msg_footer = '%(real_name) footer' mlist.real_name = 'XTest' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Here is a message. """) @@ -780,7 +780,7 @@ Here is a message. mlist.msg_footer = '%(real_name)p footer' mlist.real_name = 'XTest' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Here is a message. """) @@ -795,7 +795,7 @@ Here is a message. mlist.msg_header = '%(spooge)s header\n' mlist.msg_footer = '%(spooge)s footer' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Here is a message. """) @@ -811,12 +811,12 @@ Here is a message. mlist.msg_header = 'header' mlist.msg_footer = 'footer' msg1 = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Here is the first message. """) msg2 = email.message_from_string("""\ -From: bperson@dom.ain +From: bperson@example.com Here is the second message. """) @@ -838,12 +838,12 @@ Content-Disposition: inline header --BOUNDARY -From: aperson@dom.ain +From: aperson@example.org Here is the first message. --BOUNDARY -From: bperson@dom.ain +From: bperson@example.com Here is the second message. @@ -862,7 +862,7 @@ footer mlist.msg_header = 'header\n' mlist.msg_footer = 'footer' msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Content-type: image/x-spooge IMAGEDATAIMAGEDATAIMAGEDATA @@ -897,13 +897,13 @@ class TestFileRecips(TestBase): def test_file_exists_no_sender(self): msg = email.message_from_string("""\ -To: yall@dom.ain +To: yall@example.com """, Message.Message) msgdata = {} file = os.path.join(self._mlist.fullpath(), 'members.txt') - addrs = ['aperson@dom.ain', 'bperson@dom.ain', - 'cperson@dom.ain', 'dperson@dom.ain'] + addrs = ['aperson@example.org', 'bperson@example.com', + 'cperson@example.com', 'dperson@example.com'] fp = open(file, 'w') try: for addr in addrs: @@ -919,14 +919,14 @@ To: yall@dom.ain def test_file_exists_no_member(self): msg = email.message_from_string("""\ -From: eperson@dom.ain -To: yall@dom.ain +From: eperson@example.com +To: yall@example.com """, Message.Message) msgdata = {} file = os.path.join(self._mlist.fullpath(), 'members.txt') - addrs = ['aperson@dom.ain', 'bperson@dom.ain', - 'cperson@dom.ain', 'dperson@dom.ain'] + addrs = ['aperson@example.org', 'bperson@example.com', + 'cperson@example.com', 'dperson@example.com'] fp = open(file, 'w') try: for addr in addrs: @@ -942,14 +942,14 @@ To: yall@dom.ain def test_file_exists_is_member(self): msg = email.message_from_string("""\ -From: aperson@dom.ain -To: yall@dom.ain +From: aperson@example.org +To: yall@example.com """, Message.Message) msgdata = {} file = os.path.join(self._mlist.fullpath(), 'members.txt') - addrs = ['aperson@dom.ain', 'bperson@dom.ain', - 'cperson@dom.ain', 'dperson@dom.ain'] + addrs = ['aperson@example.org', 'bperson@example.com', + 'cperson@example.com', 'dperson@example.com'] fp = open(file, 'w') try: for addr in addrs: @@ -995,7 +995,7 @@ class TestHold(TestBase): def test_administrivia(self): msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Subject: unsubscribe """, Message.Message) @@ -1005,11 +1005,11 @@ Subject: unsubscribe def test_max_recips(self): self._mlist.max_num_recipients = 5 msg = email.message_from_string("""\ -From: aperson@dom.ain -To: _xtest@dom.ain, bperson@dom.ain -Cc: cperson@dom.ain -Cc: dperson@dom.ain (Jimmy D. Person) -To: Billy E. Person <eperson@dom.ain> +From: aperson@example.org +To: _xtest@example.com, bperson@example.com +Cc: cperson@example.com +Cc: dperson@example.com (Jimmy D. Person) +To: Billy E. Person <eperson@example.com> Hey folks! """, Message.Message) @@ -1019,7 +1019,7 @@ Hey folks! def test_implicit_destination(self): self._mlist.require_explicit_destination = 1 msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Subject: An implicit message """, Message.Message) @@ -1029,7 +1029,7 @@ Subject: An implicit message def test_implicit_destination_fromusenet(self): self._mlist.require_explicit_destination = 1 msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Subject: An implicit message """, Message.Message) @@ -1037,10 +1037,10 @@ Subject: An implicit message self.assertEqual(rtn, None) def test_suspicious_header(self): - self._mlist.bounce_matching_headers = 'From: .*person@(blah.)?dom.ain' + self._mlist.bounce_matching_headers = 'From: .*person@(blah.)?example.org' msg = email.message_from_string("""\ -From: aperson@dom.ain -To: _xtest@dom.ain +From: aperson@example.org +To: _xtest@example.net Subject: An implicit message """, Message.Message) @@ -1048,10 +1048,10 @@ Subject: An implicit message self._mlist, msg, {}) def test_suspicious_header_ok(self): - self._mlist.bounce_matching_headers = 'From: .*person@blah.dom.ain' + self._mlist.bounce_matching_headers = 'From: .*person@blah.example.com' msg = email.message_from_string("""\ -From: aperson@dom.ain -To: _xtest@dom.ain +From: aperson@example.org +To: _xtest@example.com Subject: An implicit message """, Message.Message) @@ -1061,8 +1061,8 @@ Subject: An implicit message def test_max_message_size(self): self._mlist.max_message_size = 1 msg = email.message_from_string("""\ -From: aperson@dom.ain -To: _xtest@dom.ain +From: aperson@example.org +To: _xtest@example.com xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -1088,7 +1088,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx self._mlist.admin_immed_notify = 1 # Now cause an implicit destination hold msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org """, Message.Message) self.assertRaises(Hold.ImplicitDestination, Hold.process, @@ -1106,9 +1106,9 @@ From: aperson@dom.ain # messages or the metadata files... keys = qfiles.keys() keys.sort() - eq(keys, ['_xtest-owner@dom.ain', 'aperson@dom.ain']) + eq(keys, ['_xtest-owner@example.com', 'aperson@example.org']) # Get the pending cookie from the message to the sender - pmsg, pdata = qfiles['aperson@dom.ain'] + pmsg, pdata = qfiles['aperson@example.org'] confirmlines = pmsg.get_payload().split('\n') cookie = confirmlines[-3].split('/')[-1] # We also need to make sure there's an entry in the Pending database @@ -1134,7 +1134,7 @@ class TestMimeDel(TestBase): def test_outer_matches(self): msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Content-Type: image/jpeg MIME-Version: 1.0 @@ -1146,7 +1146,7 @@ xxxxx def test_strain_multipart(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Content-Type: multipart/mixed; boundary=BOUNDARY MIME-Version: 1.0 @@ -1172,7 +1172,7 @@ yyy def test_collapse_multipart_alternative(self): eq = self.assertEqual msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Content-Type: multipart/mixed; boundary=BOUNDARY MIME-Version: 1.0 @@ -1209,7 +1209,7 @@ yyy program = config.HTML_TO_PLAIN_TEXT_COMMAND.split()[0] if os.path.isfile(program): msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Content-Type: text/html MIME-Version: 1.0 @@ -1224,7 +1224,7 @@ MIME-Version: 1.0 eq = self.assertEqual self._mlist.filter_mime_types.append('text/html') msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Content-Type: multipart/mixed; boundary=AAA --AAA @@ -1279,7 +1279,7 @@ aaa eq = self.assertEqual self._mlist.filter_mime_types.append('text/html') msg = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org Content-Type: multipart/alternative; boundary=AAA --AAA @@ -1317,12 +1317,12 @@ class TestSpamDetect(TestBase): def test_spam_detect(self): msg1 = email.message_from_string("""\ -From: aperson@dom.ain +From: aperson@example.org A message. """) msg2 = email.message_from_string("""\ -To: xlist@dom.ain +To: xlist@example.com A message. """) @@ -1510,8 +1510,8 @@ It rocks! class TestToDigest(TestBase): def _makemsg(self, i=0): - msg = email.message_from_string("""From: aperson@dom.ain -To: _xtest@dom.ain + msg = email.message_from_string("""From: aperson@example.org +To: _xtest@example.com Subject: message number %(i)d Here is message %(i)d @@ -1621,7 +1621,7 @@ It rocks! eq(data['foo'], 1) eq(data['bar'], 2) eq(data['version'], 3) - eq(data['listname'], '_xtest') + eq(data['listname'], '_xtest@example.com') eq(data['verp'], 1) # Clock skew makes this unreliable #self.failUnless(data['received_time'] <= time.time()) @@ -1670,7 +1670,7 @@ Mailman rocks! msg2, data = self._sb.dequeue(files[0]) eq(msg.as_string(unixfrom=0), msg2.as_string(unixfrom=0)) eq(data['version'], 3) - eq(data['listname'], '_xtest') + eq(data['listname'], '_xtest@example.com') # Clock skew makes this unreliable #self.failUnless(data['received_time'] <= time.time()) diff --git a/Mailman/testing/test_message.py b/Mailman/testing/test_message.py index 504adfc9e..822449064 100644 --- a/Mailman/testing/test_message.py +++ b/Mailman/testing/test_message.py @@ -32,43 +32,44 @@ class TestSentMessage(EmailBase): eq = self.assertEqual unless = self.failUnless msg = Message.UserNotification( - 'aperson@dom.ain', - '_xtest@dom.ain', + 'aperson@example.org', + '_xtest@example.com', 'Your Test List', 'About your test list') msg.send(self._mlist) qmsg = email.message_from_string(self._readmsg()) eq(qmsg['subject'], 'Your Test List') - eq(qmsg['from'], '_xtest@dom.ain') - eq(qmsg['to'], 'aperson@dom.ain') + eq(qmsg['from'], '_xtest@example.com') + eq(qmsg['to'], 'aperson@example.org') # The Message-ID: header has some time-variant information msgid = qmsg['message-id'] unless(msgid.startswith('<mailman.')) - unless(msgid.endswith('._xtest@dom.ain>')) - eq(qmsg['sender'], '_xtest-bounces@dom.ain') - eq(qmsg['errors-to'], '_xtest-bounces@dom.ain') - eq(qmsg['x-beenthere'], '_xtest@dom.ain') + unless(msgid.endswith('._xtest@example.com>')) + eq(qmsg['sender'], '_xtest-bounces@example.com') + eq(qmsg['errors-to'], '_xtest-bounces@example.com') + eq(qmsg['x-beenthere'], '_xtest@example.com') eq(qmsg['x-mailman-version'], Version.VERSION) eq(qmsg['precedence'], 'bulk') # UserNotifications have reduced_list_headers so it won't have # List-Help, List-Subscribe, or List-Unsubscribe. XXX Why would that # possibly be? - eq(qmsg['list-help'], '<mailto:_xtest-request@dom.ain?subject=help>') + eq(qmsg['list-help'], + '<mailto:_xtest-request@example.com?subject=help>') eq(qmsg['list-subscribe'], """\ -<http://www.dom.ain/mailman/listinfo/_xtest>, -\t<mailto:_xtest-request@dom.ain?subject=subscribe>""") - eq(qmsg['list-id'], '<_xtest.dom.ain>') +<http://www.example.com/mailman/listinfo/_xtest>, +\t<mailto:_xtest-request@example.com?subject=subscribe>""") + eq(qmsg['list-id'], '<_xtest.example.com>') eq(qmsg['list-unsubscribe'], """\ -<http://www.dom.ain/mailman/listinfo/_xtest>, -\t<mailto:_xtest-request@dom.ain?subject=unsubscribe>""") +<http://www.example.com/mailman/listinfo/_xtest>, +\t<mailto:_xtest-request@example.com?subject=unsubscribe>""") eq(qmsg.get_payload(), 'About your test list') def test_bounce_message(self): eq = self.assertEqual unless = self.failUnless msg = email.message_from_string("""\ -To: _xtest@dom.ain -From: nobody@dom.ain +To: _xtest@example.com +From: nobody@example.com Subject: and another thing yadda yadda yadda |
