2016-03-21 09:20:38 +00:00
|
|
|
import pytest
|
|
|
|
|
|
2016-04-06 14:31:33 +01:00
|
|
|
from app.clients.sms.firetext import get_firetext_responses
|
2016-03-21 09:20:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_should_return_correct_details_for_delivery():
|
2016-04-06 14:31:33 +01:00
|
|
|
response_dict = get_firetext_responses('0')
|
|
|
|
|
assert response_dict['message'] == 'Delivered'
|
|
|
|
|
assert response_dict['notification_status'] == 'delivered'
|
|
|
|
|
assert response_dict['notification_statistics_status'] == 'delivered'
|
|
|
|
|
assert response_dict['success']
|
2016-03-21 09:20:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_should_return_correct_details_for_bounced():
|
2016-04-06 14:31:33 +01:00
|
|
|
response_dict = get_firetext_responses('1')
|
|
|
|
|
assert response_dict['message'] == 'Declined'
|
|
|
|
|
assert response_dict['notification_status'] == 'failed'
|
|
|
|
|
assert response_dict['notification_statistics_status'] == 'failure'
|
|
|
|
|
assert not response_dict['success']
|
2016-03-21 09:20:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_should_return_correct_details_for_complaint():
|
2016-04-06 14:31:33 +01:00
|
|
|
response_dict = get_firetext_responses('2')
|
|
|
|
|
assert response_dict['message'] == 'Undelivered (Pending with Network)'
|
2016-04-08 16:13:10 +01:00
|
|
|
assert response_dict['notification_status'] == 'delivered'
|
|
|
|
|
assert response_dict['notification_statistics_status'] == 'delivered'
|
|
|
|
|
assert response_dict['success']
|
2016-03-21 09:20:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_should_be_none_if_unrecognised_status_code():
|
|
|
|
|
with pytest.raises(KeyError) as e:
|
2016-04-06 14:31:33 +01:00
|
|
|
get_firetext_responses('99')
|
2016-03-21 09:20:38 +00:00
|
|
|
assert '99' in str(e.value)
|