From 8a5448f2aff2700c8e3183f4575f0da26788e7f1 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 18 Sep 2017 11:13:33 -0300 Subject: [test] use swaks on e2e test --- tests/e2e/utils.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/e2e/utils.py b/tests/e2e/utils.py index 3fca28b8..e4c9df7e 100644 --- a/tests/e2e/utils.py +++ b/tests/e2e/utils.py @@ -8,8 +8,7 @@ import treq import urllib from string import ascii_lowercase -from email.mime.text import MIMEText -from subprocess import Popen, PIPE +from subprocess import check_call from twisted.internet import reactor from twisted.internet.defer import returnValue @@ -138,11 +137,17 @@ def send_email(username): address = "%s@%s" % (username, _provider) print("sending email to %s" % address) secret = ''.join(random.choice(ascii_lowercase) for i in range(20)) - msg = MIMEText(secret) - msg["To"] = address - msg["Subject"] = "e2e test token" - p = Popen(["/usr/sbin/sendmail", "-t"], stdin=PIPE) - p.communicate(msg.as_string()) + cmd = [ + 'swaks', + '--silent', '2', + '--helo', 'ci.leap.se', + '-f', 'ci@leap.se', + '-t', address, + '-h-Subject', 'e2e test token', + '--body', secret, + '-tlsc' + ] + check_call(cmd) return secret -- cgit v1.2.3