summaryrefslogtreecommitdiff
path: root/src/mailman/testing/mta.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-04-06 18:58:44 -0400
committerBarry Warsaw2017-04-06 18:58:44 -0400
commit845eaedfdffd879af2ef3a50227f3b3fa763d26e (patch)
treef042fafb500ccc7a67a001281cf1124afd9d6e97 /src/mailman/testing/mta.py
parent263711b3b7988c7c474e3b8952dc7e0f02f04fa2 (diff)
downloadmailman-845eaedfdffd879af2ef3a50227f3b3fa763d26e.tar.gz
mailman-845eaedfdffd879af2ef3a50227f3b3fa763d26e.tar.zst
mailman-845eaedfdffd879af2ef3a50227f3b3fa763d26e.zip
Diffstat (limited to 'src/mailman/testing/mta.py')
-rw-r--r--src/mailman/testing/mta.py25
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()