mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-06 14:48:24 -04:00
Merge pull request #1278 from alphagov/removing-placeholders-non-breaking
Make removing placeholders a non-breaking change
This commit is contained in:
@@ -259,7 +259,7 @@ def edit_service_template(service_id, template_id):
|
|||||||
'process_type': form.process_type.data
|
'process_type': form.process_type.data
|
||||||
}, current_service)
|
}, current_service)
|
||||||
template_change = get_template(template, current_service).compare_to(new_template)
|
template_change = get_template(template, current_service).compare_to(new_template)
|
||||||
if template_change.has_different_placeholders and not request.form.get('confirm'):
|
if template_change.placeholders_added and not request.form.get('confirm'):
|
||||||
example_column_headings = (
|
example_column_headings = (
|
||||||
first_column_headings[new_template.template_type] +
|
first_column_headings[new_template.template_type] +
|
||||||
list(new_template.placeholders)
|
list(new_template.placeholders)
|
||||||
|
|||||||
@@ -405,6 +405,38 @@ def test_should_show_interstitial_when_making_breaking_change(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_removing_placeholders_is_not_a_breaking_change(
|
||||||
|
logged_in_client,
|
||||||
|
mock_get_service_email_template,
|
||||||
|
mock_update_service_template,
|
||||||
|
mock_has_permissions,
|
||||||
|
fake_uuid,
|
||||||
|
):
|
||||||
|
service_id = fake_uuid
|
||||||
|
template_id = fake_uuid
|
||||||
|
existing_template = mock_get_service_email_template(0, 0)['data']
|
||||||
|
response = logged_in_client.post(
|
||||||
|
url_for(
|
||||||
|
'.edit_service_template',
|
||||||
|
service_id=service_id,
|
||||||
|
template_id=template_id
|
||||||
|
),
|
||||||
|
data={
|
||||||
|
'name': existing_template['name'],
|
||||||
|
'template_content': "no placeholders",
|
||||||
|
'subject': existing_template['subject'],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response.status_code == 302
|
||||||
|
assert response.location == url_for(
|
||||||
|
'main.view_template',
|
||||||
|
service_id=service_id,
|
||||||
|
template_id=template_id,
|
||||||
|
_external=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_should_not_create_too_big_template(
|
def test_should_not_create_too_big_template(
|
||||||
logged_in_client,
|
logged_in_client,
|
||||||
service_one,
|
service_one,
|
||||||
|
|||||||
Reference in New Issue
Block a user