Update email_from when the service name is changed.

Update unit tests
Service name is uniqueness is not based on case.
This commit is contained in:
Rebecca Law
2016-03-30 17:12:00 +01:00
parent 9de80d685a
commit 677237ba47
7 changed files with 87 additions and 90 deletions

View File

@@ -77,14 +77,15 @@ def mock_update_service(mocker):
active,
limit,
restricted,
users):
users,
email_from):
service = service_json(
service_id, service_name, users, limit=limit,
active=active, restricted=restricted)
active=active, restricted=restricted, email_from=email_from)
return {'data': service}
return mocker.patch(
'app.service_api_client.update_service', side_effect=_update)
'app.service_api_client.update_service', side_effect=_update, autospec=True)
@pytest.fixture(scope='function')
@@ -94,7 +95,8 @@ def mock_update_service_raise_httperror_duplicate_name(mocker):
active,
limit,
restricted,
users):
users,
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")