Prefix all SMS messages with service name

Implements https://github.com/alphagov/notifications-utils/pull/4
This commit is contained in:
Chris Hill-Scott
2016-03-01 08:48:27 +00:00
parent fa4b2e16e7
commit 0e5d72494e
3 changed files with 13 additions and 7 deletions

View File

@@ -104,7 +104,7 @@ def test_should_send_template_to_correct_sms_provider_and_persist(sample_templat
now
)
firetext_client.send_sms.assert_called_once_with("+441234123123", "Hello Jo")
firetext_client.send_sms.assert_called_once_with("+441234123123", "Sample service: Hello Jo")
persisted_notification = notifications_dao.get_notification(
sample_template_with_placeholders.service_id, notification_id
)
@@ -136,7 +136,7 @@ def test_should_send_template_to_correct_sms_provider_and_persist_with_job_id(sa
"encrypted-in-reality",
now)
firetext_client.send_sms.assert_called_once_with("+441234123123", sample_job.template.content)
firetext_client.send_sms.assert_called_once_with("+441234123123", "Sample service: This is a template")
persisted_notification = notifications_dao.get_notification(sample_job.template.service_id, notification_id)
assert persisted_notification.id == notification_id
assert persisted_notification.to == '+441234123123'
@@ -174,7 +174,9 @@ def test_should_use_email_template_and_persist(sample_email_template_with_placeh
"subject",
"Hello Jo"
)
persisted_notification = notifications_dao.get_notification(sample_email_template_with_placeholders.service_id, notification_id)
persisted_notification = notifications_dao.get_notification(
sample_email_template_with_placeholders.service_id, notification_id
)
assert persisted_notification.id == notification_id
assert persisted_notification.to == 'my_email@my_email.com'
assert persisted_notification.template_id == sample_email_template_with_placeholders.id
@@ -202,7 +204,7 @@ def test_should_persist_notification_as_failed_if_sms_client_fails(sample_templa
"encrypted-in-reality",
now)
firetext_client.send_sms.assert_called_once_with("+441234123123", sample_template.content)
firetext_client.send_sms.assert_called_once_with("+441234123123", "Sample service: This is a template")
persisted_notification = notifications_dao.get_notification(sample_template.service_id, notification_id)
assert persisted_notification.id == notification_id
assert persisted_notification.to == '+441234123123'

View File

@@ -328,6 +328,7 @@ def test_send_notification_invalid_template_id(notify_api, sample_template, mock
test_string = 'Template {} not found for service {}'.format(9999, sample_template.service.id)
assert test_string in json_resp['message']['template']
@freeze_time("2016-01-01 11:09:00.061258")
def test_send_notification_with_placeholders_replaced(notify_api, sample_template_with_placeholders, mocker):
with notify_api.test_request_context():