Inline duplicate service fixture with test

Similarly to the previous commit, this fixture is only used once,
so can benefit from being inline with its test.
This commit is contained in:
Ben Thorner
2021-02-15 11:41:26 +00:00
parent 52a5da4d17
commit 00cc67f813
2 changed files with 13 additions and 20 deletions

View File

@@ -587,25 +587,6 @@ def mock_create_service(mocker):
'app.service_api_client.create_service', side_effect=_create)
@pytest.fixture(scope='function')
def mock_create_duplicate_service(mocker):
def _create(
service_name,
organisation_type,
message_limit,
restricted,
user_id,
email_from,
):
json_mock = Mock(return_value={'message': {'name': ["Duplicate service name '{}'".format(service_name)]}})
resp_mock = Mock(status_code=400, json=json_mock)
http_error = HTTPError(response=resp_mock, message="Default message")
raise http_error
return mocker.patch(
'app.service_api_client.create_service', side_effect=_create)
@pytest.fixture(scope='function')
def mock_update_service(mocker):
def _update(service_id, **kwargs):