From 5a52e5447384672471ddd4c9fbb62f63e740b029 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 14 Dec 2016 16:23:37 -0200 Subject: [#845] Fixes absence of email in functional test We noticed we had timeout issues while waiting for an email in inbox. To solve this, we stopped using deferred in async calls and used @wait_for instead. With @thaissiqueira. --- .../test/functional/features/steps/data_setup.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'service/test/functional') diff --git a/service/test/functional/features/steps/data_setup.py b/service/test/functional/features/steps/data_setup.py index 3d28baed..16d2395b 100644 --- a/service/test/functional/features/steps/data_setup.py +++ b/service/test/functional/features/steps/data_setup.py @@ -26,29 +26,35 @@ def add_mail_impl(context): input_mail = MailBuilder().with_subject(subject).build_input_mail() - context.single_user_client.add_mail_to_inbox(input_mail) + load_mail_into_soledad(context, input_mail) wait_for_condition(context, lambda _: context.single_user_client.search_engine.search(subject)[1] > 0, poll_frequency=0.1) context.last_subject = subject - @given('I have a mail for {username} in my inbox') def add_mail_to_user_inbox(context, username): subject = 'Hi! This the subject %s' % uuid4() input_mail = MailBuilder().with_subject(subject).build_input_mail() - context.multi_user_client.add_mail_to_user_inbox(input_mail, username) + load_mail_into_user_account(context, input_mail, username) wait_for_condition(context, lambda _: context.multi_user_client.account_for(username).search_engine.search(subject)[1] > 0, poll_frequency=0.1) context.last_subject = subject +@given(u'Account for user {username} exists') +def add_account(context, username): + add_multi_user_account(context, username) + @wait_for(timeout=10.0) -def add_multi_user_account(context, username): - return context.multi_user_client.create_user('username') +def load_mail_into_soledad(context, mail): + return context.single_user_client.mail_store.add_mail('INBOX', mail.raw) +@wait_for(timeout=10.0) +def load_mail_into_user_account(context, mail, username): + return context.multi_user_client.add_mail_to_user_inbox(mail, username) -@given(u'Account for user {username} exists') -def add_account(context, username): - add_multi_user_account(context, username) +@wait_for(timeout=10.0) +def add_multi_user_account(context, username): + return context.multi_user_client.create_user('username') -- cgit v1.2.3