diff options
Diffstat (limited to 'src/mailman/testing/mta.py')
| -rw-r--r-- | src/mailman/testing/mta.py | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/mailman/testing/mta.py b/src/mailman/testing/mta.py index 6b803b41a..ef4d39233 100644 --- a/src/mailman/testing/mta.py +++ b/src/mailman/testing/mta.py @@ -17,7 +17,6 @@ """Fake MTA for testing purposes.""" -import socket import asyncio import smtplib @@ -54,6 +53,17 @@ class ConnectionCountingHandler(MessageHandler): def handle_message(self, message): self._msg_queue.put(message) + @asyncio.coroutine + def handle_EHLO(self, server, session, envelope, hostname): + session.host_name = hostname + yield from server.push('250-AUTH PLAIN') + return '250 HELP' + + @asyncio.coroutine + def handle_RSET(self, server, session, envelope): + self.connection_count = 0 + return '250 OK' + class ConnectionCountingSMTP(SMTP): def __init__(self, handler, oob_queue, err_queue, *args, **kws): @@ -96,14 +106,6 @@ class ConnectionCountingSMTP(SMTP): yield from self.push('571 Bad authentication') @asyncio.coroutine - def ehlo_hook(self): - yield from self.push('250-AUTH PLAIN') - - @asyncio.coroutine - def rset_hook(self): - self.event_handler.connection_count = 0 - - @asyncio.coroutine def smtp_STAT(self, arg): """Cause the server to send statistics to its controller.""" # Do not count the connection caused by the STAT connect. @@ -175,11 +177,6 @@ class ConnectionCountingController(Controller): return ConnectionCountingSMTP( self.handler, self._oob_queue, self.err_queue) - def make_socket(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True) - return sock - def start(self): super().start() # Reset the connection statistics, since the base class's start() |
