summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaeff <hi@kaeff.net>2015-08-18 15:31:02 +0200
committerkaeff <hi@kaeff.net>2015-08-18 15:31:02 +0200
commit7f754f38469203d01ef4c955fda13c07b202326f (patch)
treed8df17e71864894be2abbf81c313829decbb0d55
parent2b36ee99cec639363c4e84020d37989a9a54ad52 (diff)
Delete mail after attachments FT to avoid false negative
Since attachments.feature didn't clean up after itself, search_and_destroy failed afterwards (relied on an empty mailbox)
-rw-r--r--service/test/functional/features/environment.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py
index 07b733de..e753fca9 100644
--- a/service/test/functional/features/environment.py
+++ b/service/test/functional/features/environment.py
@@ -18,6 +18,7 @@ import uuid
from crochet import setup, wait_for
from leap.common.events.server import ensure_server
+from twisted.internet import defer
from test.support.dispatcher.proxy import Proxy
from test.support.integration import AppTestClient
from selenium import webdriver
@@ -63,10 +64,22 @@ def after_step(context, step):
context.browser.save_screenshot('failed ' + str(step.name) + '_' + id + ".png")
save_source(context, 'failed ' + str(step.name) + '_' + id + ".html")
-
def after_feature(context, feature):
context.browser.quit()
+ cleanup_all_mails(context)
+ context.last_mail = None
+
+@wait_for(timeout=10.0)
+def cleanup_all_mails(context):
+ @defer.inlineCallbacks
+ def _delete_all_mails():
+ mails = yield context.client.mail_store.all_mails()
+ for mail in mails:
+ yield context.client.mail_store.delete_mail(mail.ident)
+
+ return _delete_all_mails()
+
def save_source(context, filename='/tmp/source.html'):
with open(filename, 'w') as out: