mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-15 07:18:58 -04:00
Merge pull request #568 from alphagov/template_history_view
Template history view
This commit is contained in:
@@ -9,6 +9,7 @@ from . import (
|
||||
service_json,
|
||||
TestClient,
|
||||
template_json,
|
||||
template_version_json,
|
||||
api_key_json,
|
||||
job_json,
|
||||
notification_json,
|
||||
@@ -203,13 +204,55 @@ def mock_get_aggregate_service_statistics(mocker):
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_service_template(mocker):
|
||||
def _get(service_id, template_id):
|
||||
def _get(service_id, template_id, version=None):
|
||||
template = template_json(
|
||||
service_id, template_id, "Two week reminder", "sms", "Your vehicle tax is about to expire")
|
||||
if version:
|
||||
template.update({'version': version})
|
||||
return {'data': template}
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_service_template', side_effect=_get)
|
||||
'app.service_api_client.get_service_template',
|
||||
side_effect=_get
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_template_version(mocker, fake_uuid, user=None):
|
||||
if user is None:
|
||||
user = api_user_active(fake_uuid)
|
||||
|
||||
def _get(service_id, template_id, version):
|
||||
template_version = template_version_json(
|
||||
service_id,
|
||||
template_id,
|
||||
user,
|
||||
version=version
|
||||
)
|
||||
return {'data': template_version}
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_service_template',
|
||||
side_effect=_get
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_template_versions(mocker, fake_uuid, user=None):
|
||||
if user is None:
|
||||
user = api_user_active(fake_uuid)
|
||||
|
||||
def _get(service_id, template_id):
|
||||
template_version = template_version_json(
|
||||
service_id,
|
||||
template_id,
|
||||
user,
|
||||
version=1
|
||||
)
|
||||
return {'data': [template_version]}
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_service_template_versions',
|
||||
side_effect=_get
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
@@ -221,7 +264,9 @@ def mock_get_service_template_with_placeholders(mocker):
|
||||
return {'data': template}
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_service_template', side_effect=_get)
|
||||
'app.service_api_client.get_service_template',
|
||||
side_effect=_get
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
|
||||
Reference in New Issue
Block a user