From c272d023c4a05d5320a9a787af8a36f5bcf15c75 Mon Sep 17 00:00:00 2001 From: Ken Tsang Date: Thu, 22 Mar 2018 16:12:33 +0000 Subject: [PATCH] Lowercase the client name when sent_by is empty --- app/notifications/process_client_response.py | 2 +- tests/app/notifications/test_process_client_response.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/notifications/process_client_response.py b/app/notifications/process_client_response.py index afc718ba6..fad305cac 100644 --- a/app/notifications/process_client_response.py +++ b/app/notifications/process_client_response.py @@ -85,7 +85,7 @@ def _process_for_status(notification_status, client_name, provider_reference): statsd_client.incr('callback.{}.{}'.format(client_name.lower(), notification_status)) if not notification.sent_by: - set_notification_sent_by(notification, client_name) + set_notification_sent_by(notification, client_name.lower()) if notification.sent_at: statsd_client.timing_with_dates( diff --git a/tests/app/notifications/test_process_client_response.py b/tests/app/notifications/test_process_client_response.py index 4a5299555..1ea18cb69 100644 --- a/tests/app/notifications/test_process_client_response.py +++ b/tests/app/notifications/test_process_client_response.py @@ -95,7 +95,7 @@ def test_process_sms_updates_sent_by_with_client_name_if_not_in_noti(notify_db, status='3', provider_reference=str(sample_notification.id), client_name='MMG') assert error is None assert success == 'MMG callback succeeded. reference {} updated'.format(sample_notification.id) - assert sample_notification.sent_by == 'MMG' + assert sample_notification.sent_by == 'mmg' def test_process_sms_does_not_update_sent_by_if_already_set(mocker, notify_db, sample_notification):