mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
@@ -219,7 +219,7 @@ def mock_get_service_email_template(mocker):
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_create_service_template(mocker, fake_uuid):
|
||||
def _create(name, type_, content, service):
|
||||
def _create(name, type_, content, service, subject=None):
|
||||
template = template_json(
|
||||
fake_uuid, name, type_, content, service)
|
||||
return {'data': template}
|
||||
@@ -241,6 +241,42 @@ def mock_update_service_template(mocker):
|
||||
side_effect=_update)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_create_service_template_content_too_big(mocker):
|
||||
def _create(name, type_, content, service, subject=None):
|
||||
json_mock = Mock(return_value={
|
||||
'message': {'content': ["Content has a character count greater than the limit of 459"]},
|
||||
'result': 'error'
|
||||
})
|
||||
resp_mock = Mock(status_code=400, json=json_mock)
|
||||
http_error = HTTPError(
|
||||
response=resp_mock,
|
||||
message={'content': ["Content has a character count greater than the limit of 459"]})
|
||||
raise http_error
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.create_service_template',
|
||||
side_effect=_create)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_update_service_template_400_content_too_big(mocker):
|
||||
def _update(id_, name, type_, content, service, subject=None):
|
||||
json_mock = Mock(return_value={
|
||||
'message': {'content': ["Content has a character count greater than the limit of 459"]},
|
||||
'result': 'error'
|
||||
})
|
||||
resp_mock = Mock(status_code=400, json=json_mock)
|
||||
http_error = HTTPError(
|
||||
response=resp_mock,
|
||||
message={'content': ["Content has a character count greater than the limit of 459"]})
|
||||
raise http_error
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.update_service_template',
|
||||
side_effect=_update)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_service_templates(mocker):
|
||||
uuid1 = str(generate_uuid())
|
||||
|
||||
Reference in New Issue
Block a user