diff options
author | Anike Arni <aarni@thoughtworks.com> | 2016-12-14 16:23:37 -0200 |
---|---|---|
committer | Anike Arni <aarni@thoughtworks.com> | 2016-12-14 16:23:37 -0200 |
commit | 5a52e5447384672471ddd4c9fbb62f63e740b029 (patch) | |
tree | 38282ec8cae160b74e661415ec3faf2963d18494 /service/test | |
parent | f6ee8978e6195fa3f25fe2dedd20e5ed9ebf598e (diff) |
[#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.
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/functional/features/steps/data_setup.py | 22 |
1 files changed, 14 insertions, 8 deletions
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') |