From 7f754f38469203d01ef4c955fda13c07b202326f Mon Sep 17 00:00:00 2001 From: kaeff Date: Tue, 18 Aug 2015 15:31:02 +0200 Subject: 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) --- service/test/functional/features/environment.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'service/test/functional/features/environment.py') 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: -- cgit v1.2.3