Reduce the errors related to user fixtures

We were using user fixtures in a lot of parameterized tests, but this is
no longer allowed in Pytest 5. To avoid having to split up the parametrized
tests (which would make the test files a lot longer and slightly more
difficult to read) this commit creates functions which return various types
of user json so that we can use these as the test parameters instead.
This commit is contained in:
Katie Smith
2019-12-19 16:59:07 +00:00
parent b62018a8e4
commit e4134072d9
17 changed files with 412 additions and 231 deletions

View File

@@ -5,8 +5,7 @@ import pytest
from flask import url_for
from notifications_utils.url_safe_token import generate_token
from tests.conftest import api_user_active as create_user
from tests.conftest import url_for_endpoint_with_token
from tests.conftest import create_api_user_active, url_for_endpoint_with_token
def test_should_show_overview_page(
@@ -200,11 +199,10 @@ def test_should_redirect_after_mobile_number_confirm(
mocker,
mock_update_user_attribute,
mock_check_verify_code,
fake_uuid,
phone_number_to_register_with,
):
user_before = create_user(fake_uuid)
user_after = create_user(fake_uuid)
user_before = create_api_user_active(with_unique_id=True)
user_after = create_api_user_active(with_unique_id=True)
user_before['current_session_id'] = str(uuid.UUID(int=1))
user_after['current_session_id'] = str(uuid.UUID(int=2))