mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Add process_mmg_responses
Refactor process_firetext_responses Removed the abstract ClientResponses for firetext and mmg. There is a map for each response to handle the status codes sent by each client. Since MMG has about 20 different status code, none of which seem to be a pending state (unlike firetext that has 3 status one for pending - network delay). For MMG status codes, look for 00 as successful, everything else is assumed to be a failure.
This commit is contained in:
@@ -46,6 +46,8 @@ class AnyStringWith(str):
|
||||
def firetext_error():
|
||||
return {'code': 0, 'description': 'error'}
|
||||
|
||||
mmg_error = {'Error': '40', 'Description': 'error'}
|
||||
|
||||
|
||||
def test_should_call_delete_successful_notifications_in_task(notify_api, mocker):
|
||||
mocker.patch('app.celery.tasks.delete_successful_notifications_created_more_than_a_day_ago')
|
||||
@@ -667,7 +669,7 @@ def test_should_throw_mmg_client_exception(mocker):
|
||||
'secret_code': '12345'}
|
||||
|
||||
encrypted_notification = encryption.encrypt(notification)
|
||||
mocker.patch('app.mmg_client.send_sms', side_effect=MMGClientException(firetext_error()))
|
||||
mocker.patch('app.mmg_client.send_sms', side_effect=MMGClientException(mmg_error))
|
||||
send_sms_code(encrypted_notification)
|
||||
mmg_client.send_sms.assert_called_once_with(format_phone_number(validate_phone_number(notification['to'])),
|
||||
notification['secret_code'],
|
||||
|
||||
Reference in New Issue
Block a user