summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/e2e/utils.py19
1 files changed, 12 insertions, 7 deletions
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