Skip to content

Commit 6b57c49

Browse files
aequitasbwbroersma
authored andcommitted
Add test for dummy smtp
1 parent e9124d4 commit 6b57c49

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

integration_tests/common/test_basic.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from playwright.sync_api import expect
66
import socket
77
import os
8+
import time
89

910
FOOTER_TEXT_EN = "Internet.nl is an initiative of the Internet community and the Dutch"
1011
FOOTER_TEXT_NL = "Internet.nl is een initiatief van de internetgemeenschap en de Nederlandse"
@@ -220,3 +221,17 @@ def test_cron_postgres_backups(trigger_cron, docker_compose_exec):
220221

221222
assert docker_compose_exec("cron", "ls /var/lib/postgresql/backups/internetnl_db1.daily.sql.gz")
222223
assert docker_compose_exec("cron", "ls /var/lib/postgresql/backups/internetnl_db1.weekly.sql.gz")
224+
225+
def test_mail_server(app_domain: str):
226+
"""Test if dummy SMTP server is running, see: https://github.com/internetstandards/Internet.nl/issues/1875."""
227+
228+
# connect to SMTP socket and test if HELO message is correct
229+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
230+
s.connect((app_domain, 25))
231+
s.sendall(b"HELO example.com\r\n")
232+
time.sleep(1) # second response line is not sent directly
233+
response = s.recv(1024)
234+
assert response.decode() == f"220 {app_domain} ESMTP ready\r\n250 {app_domain}\r\n"
235+
s.sendall(b"AUTH PLAIN dXNlcgB1c2VyAHB3ZA==\r\n")
236+
response = s.recv(1024)
237+
assert response == b"500 5.5.1 Invalid command\r\n"

0 commit comments

Comments
 (0)