Localise and simplify fixture to invite tests

This isn't used anywhere else.
This commit is contained in:
Ben Thorner
2021-05-25 17:55:52 +01:00
parent 754f4e3753
commit 71cbc00a3d
2 changed files with 5 additions and 8 deletions

View File

@@ -25,6 +25,11 @@ def mock_get_existing_user_by_email(mocker, api_user_active):
return mocker.patch('app.user_api_client.get_user_by_email', return_value=api_user_active)
@pytest.fixture(scope='function')
def mock_check_invite_token(mocker, sample_invite):
return mocker.patch('app.invite_api_client.check_token', return_value=sample_invite)
def test_existing_user_accept_invite_calls_api_and_redirects_to_dashboard(
client,
service_one,

View File

@@ -2482,14 +2482,6 @@ def mock_get_invites_without_manage_permission(mocker, service_one, sample_invit
return mocker.patch('app.models.user.InvitedUsers.client_method', side_effect=_get_invites)
@pytest.fixture(scope='function')
def mock_check_invite_token(mocker, sample_invite):
def _check_token(token):
return sample_invite
return mocker.patch('app.invite_api_client.check_token', side_effect=_check_token)
@pytest.fixture(scope='function')
def mock_accept_invite(mocker, sample_invite):
def _accept(service_id, invite_id):