From fef03920f08f86a9b2b3f63cade408ab370344ca Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Thu, 16 Apr 2020 13:14:29 +0100 Subject: [PATCH] Add test for a callback with a code --- tests/app/notifications/rest/test_callbacks.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/app/notifications/rest/test_callbacks.py b/tests/app/notifications/rest/test_callbacks.py index 5cb0af990..3b0810048 100644 --- a/tests/app/notifications/rest/test_callbacks.py +++ b/tests/app/notifications/rest/test_callbacks.py @@ -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",