Esempio n. 1
0
 def _go(self, message):
     lmtp = get_lmtp_client(quiet=True)
     lmtp.lhlo('remote.example.org')
     lmtp.sendmail('*****@*****.**', ['*****@*****.**'], message)
     lmtp.close()
     # The message will now be sitting in the `in` queue.  Run the incoming
     # runner once to process it, which should result in the nonmember
     # showing up.
     inq = make_testable_runner(IncomingRunner, 'in')
     inq.run()
Esempio n. 2
0
 def _go(self, message):
     lmtp = get_lmtp_client(quiet=True)
     lmtp.lhlo('remote.example.org')
     lmtp.sendmail('*****@*****.**', ['*****@*****.**'], message)
     lmtp.close()
     # The message will now be sitting in the `in` queue.  Run the incoming
     # runner once to process it, which should result in the nonmember
     # showing up.
     inq = make_testable_runner(IncomingRunner, 'in')
     inq.run()
Esempio n. 3
0
 def setUp(self):
     with transaction():
         self._mlist = create_list('*****@*****.**')
     self._lmtp = get_lmtp_client(quiet=True)
     self._lmtp.lhlo('remote.example.org')
     self.addCleanup(self._lmtp.close)
Esempio n. 4
0
 def setUp(self):
     self._lmtp = get_lmtp_client(quiet=True)
     self._lmtp.lhlo('remote.example.org')
Esempio n. 5
0
 def wait():
     get_lmtp_client(quiet=True)
Esempio n. 6
0
    def test_owners_get_email(self):
        # XXX 2012-03-23 BAW: We can't use a layer here because we need both
        # the SMTPLayer and LMTPLayer and these are incompatible.  There's no
        # way to make zope.test* happy without causing errors or worse.  Live
        # with this hack until we can rip all that layer crap out and use
        # something like testresources.
        def wait():
            get_lmtp_client(quiet=True)
        lmtpd = TestableMaster(wait)
        lmtpd.start('lmtp')
        # Post a message to the list's -owner address, and all the owners will
        # get a copy of the message.
        lmtp = get_lmtp_client(quiet=True)
        lmtp.lhlo('remote.example.org')
        lmtp.sendmail('*****@*****.**', ['*****@*****.**'], b"""\
From: Zuzu Person <*****@*****.**>
To: [email protected]
Message-ID: <ant>

Can you help me?
""")
        lmtpd.stop()
        # There should now be one message sitting in the incoming queue.
        # Check that, then process it.  Don't use get_queue_messages() since
        # that will empty the queue.
        self.assertEqual(len(config.switchboards['in'].files), 1)
        self._inq.run()
        # There should now be one message sitting in the pipeline queue.
        # Process that one too.
        self.assertEqual(len(config.switchboards['pipeline'].files), 1)
        self._pipelineq.run()
        # The message has made its way to the outgoing queue.  Again, check
        # and process that one.
        self.assertEqual(len(config.switchboards['out'].files), 1)
        self._outq.run()
        # The SMTP server has now received three messages, one for each of the
        # owners and moderators.  Of course, Bart is both an owner and a
        # moderator, so he'll get only one copy of the message.  Dave does not
        # get a copy of the message.
        messages = sorted(SMTPLayer.smtpd.messages, key=itemgetter('x-rcptto'))
        self.assertEqual(len(messages), 3)
        self.assertEqual(messages[0]['x-rcptto'], '*****@*****.**')
        self.assertEqual(messages[1]['x-rcptto'], '*****@*****.**')
        self.assertEqual(messages[2]['x-rcptto'], '*****@*****.**')
        # And yet, all three messages are addressed to the -owner address.
        for message in messages:
            self.assertEqual(message['to'], '*****@*****.**')
        # All three messages will have two X-MailFrom headers.  One is added
        # by the LMTP server accepting Zuzu's original message, and will
        # contain her posting address, i.e. [email protected].  The second one
        # is added by the lazr.smtptest server that accepts Mailman's VERP'd
        # message to the individual recipient.  By verifying both, we prove
        # that Zuzu sent the original message, and that Mailman is VERP'ing
        # the copy to all the owners.
        self.assertEqual(
            messages[0].get_all('x-mailfrom'),
            ['*****@*****.**', '[email protected]'])
        self.assertEqual(
            messages[1].get_all('x-mailfrom'),
            ['*****@*****.**', '[email protected]'])
        self.assertEqual(
            messages[2].get_all('x-mailfrom'),
            ['*****@*****.**', '[email protected]'])
Esempio n. 7
0
 def setUp(self):
     with transaction():
         self._mlist = create_list('*****@*****.**')
     self._lmtp = get_lmtp_client(quiet=True)
     self._lmtp.lhlo('remote.example.org')
     self.addCleanup(self._lmtp.close)
Esempio n. 8
0
 def setUp(self):
     self._lmtp = get_lmtp_client(quiet=True)
     self._lmtp.lhlo('remote.example.org')
Esempio n. 9
0
 def _wait_for_lmtp_server():
     get_lmtp_client(quiet=True)
Esempio n. 10
0
 def _wait_for_both(cls):
     cls.client = get_lmtp_client(quiet=True)
     wait_for_webservice()
Esempio n. 11
0
 def _wait_for_both(cls):
     cls.client = get_lmtp_client(quiet=True)
     wait_for_webservice()
Esempio n. 12
0
 def wait():
     get_lmtp_client(quiet=True)
Esempio n. 13
0
    def test_owners_get_email(self):
        # XXX 2012-03-23 BAW: We can't use a layer here because we need both
        # the SMTPLayer and LMTPLayer and these are incompatible.  There's no
        # way to make zope.test* happy without causing errors or worse.  Live
        # with this hack until we can rip all that layer crap out and use
        # something like testresources.
        def wait():
            get_lmtp_client(quiet=True)

        lmtpd = TestableMaster(wait)
        lmtpd.start('lmtp')
        # Post a message to the list's -owner address, and all the owners will
        # get a copy of the message.
        lmtp = get_lmtp_client(quiet=True)
        lmtp.lhlo('remote.example.org')
        lmtp.sendmail(
            '*****@*****.**', ['*****@*****.**'], b"""\
From: Zuzu Person <*****@*****.**>
To: [email protected]
Message-ID: <ant>

Can you help me?
""")
        lmtpd.stop()
        # There should now be one message sitting in the incoming queue.
        # Check that, then process it.  Don't use get_queue_messages() since
        # that will empty the queue.
        self.assertEqual(len(config.switchboards['in'].files), 1)
        self._inq.run()
        # There should now be one message sitting in the pipeline queue.
        # Process that one too.
        self.assertEqual(len(config.switchboards['pipeline'].files), 1)
        self._pipelineq.run()
        # The message has made its way to the outgoing queue.  Again, check
        # and process that one.
        self.assertEqual(len(config.switchboards['out'].files), 1)
        self._outq.run()
        # The SMTP server has now received three messages, one for each of the
        # owners and moderators.  Of course, Bart is both an owner and a
        # moderator, so he'll get only one copy of the message.  Dave does not
        # get a copy of the message.
        messages = sorted(SMTPLayer.smtpd.messages, key=itemgetter('x-rcptto'))
        self.assertEqual(len(messages), 3)
        self.assertEqual(messages[0]['x-rcptto'], '*****@*****.**')
        self.assertEqual(messages[1]['x-rcptto'], '*****@*****.**')
        self.assertEqual(messages[2]['x-rcptto'], '*****@*****.**')
        # And yet, all three messages are addressed to the -owner address.
        for message in messages:
            self.assertEqual(message['to'], '*****@*****.**')
        # All three messages will have two X-MailFrom headers.  One is added
        # by the LMTP server accepting Zuzu's original message, and will
        # contain her posting address, i.e. [email protected].  The second one
        # is added by the aiosmtpd server that accepts Mailman's VERP'd
        # message to the individual recipient.  By verifying both, we prove
        # that Zuzu sent the original message, and that Mailman is VERP'ing
        # the copy to all the owners.
        self.assertEqual(
            messages[0].get_all('x-mailfrom'),
            ['*****@*****.**', '[email protected]'])
        self.assertEqual(
            messages[1].get_all('x-mailfrom'),
            ['*****@*****.**', '[email protected]'])
        self.assertEqual(
            messages[2].get_all('x-mailfrom'),
            ['*****@*****.**', '[email protected]'])