mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 08:16:51 -04:00
Add feature to mark a template as redacted
Works similarly to the delete template flow, because it’s a destructive, one-way action. Not on the edit template page, because it’s not something you want to be considering every time you’re editing a template. And we saw that people couldn’t find the delete button when it was on this page. Adds a bit more CSS for the `dangerous` banner type, because the content here is quite complicated. Breaking it into a list helps, but the spacing didn’t look right, so needed some tweaking. Can ship independently of the code that shows the redaction, but needs the API first.
This commit is contained in:
@@ -942,3 +942,48 @@ def test_should_create_sms_template_without_downgrading_unicode_characters(
|
||||
ANY # process_type
|
||||
)
|
||||
assert resp.status_code == 302
|
||||
|
||||
|
||||
def test_should_show_message_before_redacting_template(
|
||||
client_request,
|
||||
mock_get_service_template,
|
||||
service_one,
|
||||
fake_uuid,
|
||||
):
|
||||
|
||||
page = client_request.get(
|
||||
'main.redact_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
)
|
||||
|
||||
assert (
|
||||
'Are you sure you want to hide personalisation after sending?'
|
||||
) in page.select('.banner-dangerous')[0].text
|
||||
|
||||
form = page.select('.banner-dangerous form')[0]
|
||||
|
||||
assert 'action' not in form
|
||||
assert form['method'] == 'post'
|
||||
|
||||
|
||||
def test_should_show_redact_template(
|
||||
client_request,
|
||||
mock_get_service_template,
|
||||
mock_redact_template,
|
||||
service_one,
|
||||
fake_uuid,
|
||||
):
|
||||
|
||||
page = client_request.post(
|
||||
'main.redact_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id=fake_uuid,
|
||||
_follow_redirects=True,
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select('.banner-default-with-tick')[0].text) == (
|
||||
'Personalised content will be hidden for messages sent with this template'
|
||||
)
|
||||
|
||||
mock_redact_template.assert_called_once_with(SERVICE_ONE_ID, fake_uuid)
|
||||
|
||||
Reference in New Issue
Block a user