mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Use Firetext client
This commit is contained in:
@@ -37,6 +37,6 @@ def send_sms_code(encrypted_notification):
|
|||||||
notification = encryption.decrypt(encrypted_notification)
|
notification = encryption.decrypt(encrypted_notification)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
twilio_client.send_sms(notification['to'], notification['secret_code'])
|
firetext_client.send_sms(notification['to'], notification['secret_code'])
|
||||||
except TwilioClientException as e:
|
except FiretextClientException as e:
|
||||||
current_app.logger.debug(e)
|
current_app.logger.debug(e)
|
||||||
|
|||||||
@@ -85,16 +85,16 @@ def test_should_send_sms_code(mocker):
|
|||||||
|
|
||||||
encrypted_notification = encryption.encrypt(notification)
|
encrypted_notification = encryption.encrypt(notification)
|
||||||
|
|
||||||
mocker.patch('app.twilio_client.send_sms')
|
mocker.patch('app.firetext_client.send_sms')
|
||||||
send_sms_code(encrypted_notification)
|
send_sms_code(encrypted_notification)
|
||||||
twilio_client.send_sms.assert_called_once_with(notification['to'], notification['secret_code'])
|
firetext_client.send_sms.assert_called_once_with(notification['to'], notification['secret_code'])
|
||||||
|
|
||||||
|
|
||||||
def test_should_throw_twilio_exception(mocker):
|
def test_should_log_firetext_client_exception(mocker):
|
||||||
notification = {'to': '+441234123123',
|
notification = {'to': '+441234123123',
|
||||||
'secret_code': '12345'}
|
'secret_code': '12345'}
|
||||||
|
|
||||||
encrypted_notification = encryption.encrypt(notification)
|
encrypted_notification = encryption.encrypt(notification)
|
||||||
mocker.patch('app.twilio_client.send_sms', side_effect=TwilioClientException)
|
mocker.patch('app.firetext_client.send_sms', side_effect=FiretextClientException)
|
||||||
send_sms_code(encrypted_notification)
|
send_sms_code(encrypted_notification)
|
||||||
twilio_client.send_sms.assert_called_once_with(notification['to'], notification['secret_code'])
|
firetext_client.send_sms.assert_called_once_with(notification['to'], notification['secret_code'])
|
||||||
|
|||||||
Reference in New Issue
Block a user