Add test for a callback with a code

This commit is contained in:
Pea Tyczynska
2020-04-16 13:14:29 +01:00
parent 470d00c26e
commit fef03920f0

View File

@@ -152,6 +152,22 @@ def test_firetext_callback_should_return_200_and_call_task_with_valid_data(clien
)
def test_firetext_callback_including_a_code_should_return_200_and_call_task_with_valid_data(client, mocker):
mock_celery = mocker.patch(
'app.notifications.notifications_sms_callback.process_sms_client_response.apply_async')
data = 'mobile=441234123123&status=1&code=101&time=2016-03-10 14:17:00&reference=notification_id'
response = firetext_post(client, data)
json_resp = json.loads(response.get_data(as_text=True))
assert response.status_code == 200
assert json_resp['result'] == 'success'
mock_celery.assert_called_once_with(
['1', 'notification_id', 'Firetext', '101'],
queue='sms-callbacks',
)
def test_mmg_callback_should_not_need_auth(client, mocker, sample_notification):
mocker.patch('app.notifications.notifications_sms_callback.process_sms_client_response')
data = json.dumps({"reference": "mmg_reference",