Update to processing the the response from MMG

MMG changed the datatype and the status codes they send us for the delivery receipts.
This PR accounts for that change.
This commit is contained in:
Rebecca Law
2016-04-20 09:45:13 +01:00
parent 6ef8bb5ada
commit 41ce691704
6 changed files with 47 additions and 11 deletions

View File

@@ -27,6 +27,25 @@ def test_validate_callback_data_return_errors_when_fields_are_empty():
assert "{} callback failed: {} missing".format(client_name, 'cid') in errors
def test_validate_callback_data_can_handle_integers():
form = {'status': 00, 'cid': 'fsdfadfsdfas'}
fields = ['status', 'cid']
client_name = 'sms client'
result = validate_callback_data(form, fields, client_name)
assert result is None
def test_validate_callback_data_returns_error_for_empty_string():
form = {'status': '', 'cid': 'fsdfadfsdfas'}
fields = ['status', 'cid']
client_name = 'sms client'
result = validate_callback_data(form, fields, client_name)
assert result is not None
assert "{} callback failed: {} missing".format(client_name, 'status') in result
def test_process_sms_response_return_success_for_send_sms_code_reference():
success, error = process_sms_client_response(status='000', reference='send-sms-code', client_name='sms-client')
assert success == "{} callback succeeded: send-sms-code".format('sms-client')