Add a selectField to edit and create templates that is only visible for platform admins that makes the template a priority template.

There is a check that the template can not be created as priority if the user is not a platform admin.
There is a check that the template can not change the `priority` unless they are a platform admin.
This commit is contained in:
Rebecca Law
2017-01-18 15:11:34 +00:00
parent dfc751ef02
commit 3dfb3806d2
8 changed files with 210 additions and 45 deletions

View File

@@ -243,6 +243,23 @@ def mock_get_service_template(mocker):
)
@pytest.fixture(scope='function')
def mock_get_service_template_with_priority(mocker):
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",
process_type='priority')
if version:
template.update({'version': version})
return {'data': template}
return mocker.patch(
'app.service_api_client.get_service_template',
side_effect=_get
)
@pytest.fixture(scope='function')
def mock_get_deleted_template(mocker):
def _get(service_id, template_id, version=None):
@@ -381,7 +398,7 @@ def mock_create_service_template(mocker, fake_uuid):
@pytest.fixture(scope='function')
def mock_update_service_template(mocker):
def _update(id_, name, type_, content, service, subject=None):
def _update(id_, name, type_, content, service, subject=None, process_type=None):
template = template_json(
service, id_, name, type_, content, subject)
return {'data': template}
@@ -393,7 +410,7 @@ def mock_update_service_template(mocker):
@pytest.fixture(scope='function')
def mock_create_service_template_content_too_big(mocker):
def _create(name, type_, content, service, subject=None):
def _create(name, type_, content, service, subject=None, process_type=None):
json_mock = Mock(return_value={
'message': {'content': ["Content has a character count greater than the limit of 459"]},
'result': 'error'
@@ -411,7 +428,7 @@ def mock_create_service_template_content_too_big(mocker):
@pytest.fixture(scope='function')
def mock_update_service_template_400_content_too_big(mocker):
def _update(id_, name, type_, content, service, subject=None):
def _update(id_, name, type_, content, service, subject=None, process_type=None):
json_mock = Mock(return_value={
'message': {'content': ["Content has a character count greater than the limit of 459"]},
'result': 'error'