def setUp(self): """ Create an in-memory mail domain to which messages may be delivered by tests and create a factory and transport to do the delivering. """ self.factory = smtp.SMTPFactory() self.factory.domains = {} self.factory.domains['baz.com'] = DummyDomain(['foo']) self.transport = StringTransport()
def testMessages(self): factory = smtp.SMTPFactory() factory.domains = {} factory.domains['foo.bar'] = DummyDomain(['moshez']) from twisted.mail.protocols import DomainSMTP protocol = DomainSMTP() protocol.service = factory protocol.factory = factory clientProtocol = self.clientClass() return self.loopback(protocol, clientProtocol)
def setUp(self): self.factory = smtp.SMTPFactory() self.factory.domains = {} self.factory.domains['baz.com'] = DummyDomain(['foo']) self.output = StringIOWithoutClosing() self.transport = internet.protocol.FileWrapper(self.output)