From dae63cd5bbdee81c33613b1fd972063a449c32bf Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Wed, 22 Mar 2017 15:18:39 +0100 Subject: [PATCH] tests: make a fixture of EmailsMocking (fixes #15555) --- tests/conftest.py | 8 +++++++- tests/test_backoffice_pages.py | 5 ++--- tests/test_form_pages.py | 7 +++---- tests/test_register.py | 8 ++++---- tests/test_workflows.py | 7 +++---- tests/utilities.py | 25 +++++++++++++++++-------- 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 15cd16d..1441562 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,7 +3,7 @@ import ConfigParser import pytest -from utilities import SMSMocking +from utilities import SMSMocking, EmailsMocking def pytest_addoption(parser): parser.addoption('--without-postgresql-tests', action='store_true', @@ -56,3 +56,9 @@ def welco_url(request, pub): def sms_mocking(): with SMSMocking() as sms: yield sms + + +@pytest.fixture +def emails(): + with EmailsMocking() as mock: + yield mock diff --git a/tests/test_backoffice_pages.py b/tests/test_backoffice_pages.py index b96d95d..8896471 100644 --- a/tests/test_backoffice_pages.py +++ b/tests/test_backoffice_pages.py @@ -32,7 +32,7 @@ from wcs.formdef import FormDef from wcs import fields from utilities import (get_app, login, create_temporary_pub, - clean_temporary_pub, emails) + clean_temporary_pub) def pytest_generate_tests(metafunc): if 'pub' in metafunc.fixturenames: @@ -2788,12 +2788,11 @@ def test_360_user_view(pub): assert resp.body.count('