summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-09-18 11:13:33 -0300
committerdrebs <drebs@riseup.net>2017-09-20 18:55:59 -0300
commit8a5448f2aff2700c8e3183f4575f0da26788e7f1 (patch)
tree3bf294a2cf7193d7a873f98c8eef60ef44460f49 /tests
parent91797686422ee624b8a5e73fd1f2660cd828bdaf (diff)
[test] use swaks on e2e test
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