Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mchlwellman committed Dec 13, 2024
1 parent 5ca1c61 commit 3446cbd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ fileignoreconfig:
checksum: 6ffb8742a19c5b834c608826fd459cc1b6ea35ebfffd2d929a3a0f269c74183d
- filename: tests/app/celery/test_service_callback_tasks.py
checksum: 70575434f7a4fedd43d4c9164bc899a606768526d432c364db372524eec26542
- filename: tests/app/clients/test_twilio.py
checksum: cad49e634cc5ba56157358aa3dfba2dafe7b9dbd3a0c580ec5cda3072f6a76e5
- filename: tests/app/conftest.py
checksum: a80aa727586db82ed1b50bdb81ddfe1379e649a9dfc1ece2c36047486b41b83d
- filename: tests/app/dao/test_api_key_dao.py
Expand All @@ -77,6 +79,8 @@ fileignoreconfig:
checksum: 4e15e63d349635131173ffdd7aebcd547621db08de877ef926d3a41fde72d065
- filename: tests/app/notifications/test_send_notifications.py
checksum: 69304e1edd6993acd9a842a87dba8ee16854befc643863e1589b15c303a71464
- filename: tests/app/v2/notifications/test_get_notifications.py
checksum: f7cef983750a27dfdedb6db88c791fe9e20fd34768577dbcaeb0c42bfc7457b4
- filename: tests/app/v2/notifications/test_post_notifications.py
checksum: 3181930a13e3679bb2f17eaa3f383512eb9caf4ed5d5e14496ca4193c6083965
- filename: tests/app/v3/notifications/test_rest.py
Expand All @@ -85,6 +89,4 @@ fileignoreconfig:
checksum: 4f0f4d7a4113762219e45a51f7b26a7c0cb83f1d8f10c5598533f6cdcf0e0ada
- filename: tests/lambda_functions/vetext_incoming_forwarder_lambda/test_vetext_incoming_forwarder_lambda.py
checksum: 7494eb4321fd2fbc3ff3915d8753d8fec7a936a69dc6ab78f0b532a701f032eb
- filename: tests/app/clients/test_twilio.py
checksum: cad49e634cc5ba56157358aa3dfba2dafe7b9dbd3a0c580ec5cda3072f6a76e5
version: "1.0"
29 changes: 28 additions & 1 deletion tests/app/v2/notifications/test_get_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_get_notification_by_id_with_placeholders_and_recipient_identifiers_retu
'template': expected_template_response,
'created_at': notification.created_at.strftime(DATETIME_FORMAT),
'created_by_name': None,
'body': 'Hello Bob\nThis is an email from va.gov',
'body': 'Hello <redacted>\nThis is an email from va.gov',
'subject': 'Subject',
'sent_at': notification.sent_at,
'sent_by': None,
Expand Down Expand Up @@ -881,3 +881,30 @@ def test_get_notifications_renames_letter_statuses(client, sample_letter_templat
json_response = json.loads(response.get_data(as_text=True))
assert response.status_code == 200
assert json_response['status'] == expected_status


@pytest.mark.parametrize('template_type', [SMS_TYPE, EMAIL_TYPE])
def test_get_notifications_removes_personalisation_from_content(
client,
sample_api_key,
sample_notification,
sample_template,
template_type,
):
template = sample_template(
content='Hello ((name))\nThis is an email from VA Notify about some ((thing))',
template_type=template_type,
)
notification = sample_notification(
template=template,
personalisation={'name': 'Bob', 'thing': 'important stuff'},
)
auth_header = create_authorization_header(sample_api_key(service=template.service))
response = client.get(
path=url_for('v2_notifications.get_notification_by_id', notification_id=notification.id),
headers=[('Content-Type', 'application/json'), auth_header],
)

json_response = json.loads(response.get_data(as_text=True))
assert response.status_code == 200
assert json_response['body'] == 'Hello <redacted>\nThis is an email from VA Notify about some <redacted>'

0 comments on commit 3446cbd

Please sign in to comment.