--- a/tests/smtp_helper.py Fri Mar 16 12:57:21 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-"""
-A helper class which allows test code to intercept and store sent email.
-(from: http://lakin.weckers.net/thoughts/twisted/part1/threaded/)
-"""
-import smtpd
-import asyncore
-
-class TestSMTPServer(smtpd.SMTPServer):
- """
- An SMTP Server used to allow integration tests which ensure email is sent.
- """
-
- def __init__(self, localaddr):
- self.rcvd = []
- smtpd.SMTPServer.__init__(self, localaddr, None)
-
- def start(self):
- import threading
- self.poller = threading.Thread(target=asyncore.loop,
- kwargs={'timeout':0.1, 'use_poll':True})
- self.poller.start()
-
- def process_message(self, peer, mailfrom, rcpttos, data):
- self.rcvd.append((mailfrom, rcpttos, data))
-
- def close(self):
- smtpd.SMTPServer.close(self)
- self.poller.join()