mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Remove firetext from notifications_sms_callback.py
This commit is contained in:
@@ -4,13 +4,6 @@ from flask import json
|
||||
from app.notifications.notifications_sms_callback import validate_callback_data
|
||||
|
||||
|
||||
def firetext_post(client, data):
|
||||
return client.post(
|
||||
path='/notifications/sms/firetext',
|
||||
data=data,
|
||||
headers=[('Content-Type', 'application/x-www-form-urlencoded')])
|
||||
|
||||
|
||||
def mmg_post(client, data):
|
||||
return client.post(
|
||||
path='/notifications/sms/mmg',
|
||||
@@ -18,80 +11,6 @@ def mmg_post(client, data):
|
||||
headers=[('Content-Type', 'application/json')])
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
|
||||
def test_firetext_callback_should_not_need_auth(client, mocker):
|
||||
mocker.patch('app.notifications.notifications_sms_callback.process_sms_client_response')
|
||||
data = 'mobile=441234123123&status=0&reference=notification_id&time=2016-03-10 14:17:00'
|
||||
|
||||
response = firetext_post(client, data)
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
|
||||
def test_firetext_callback_should_return_400_if_empty_reference(client, mocker):
|
||||
data = 'mobile=441234123123&status=0&reference=&time=2016-03-10 14:17:00'
|
||||
response = firetext_post(client, data)
|
||||
|
||||
json_resp = json.loads(response.get_data(as_text=True))
|
||||
assert response.status_code == 400
|
||||
assert json_resp['result'] == 'error'
|
||||
assert json_resp['message'] == ['Firetext callback failed: reference missing']
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
|
||||
def test_firetext_callback_should_return_400_if_no_reference(client, mocker):
|
||||
data = 'mobile=441234123123&status=0&time=2016-03-10 14:17:00'
|
||||
response = firetext_post(client, data)
|
||||
json_resp = json.loads(response.get_data(as_text=True))
|
||||
assert response.status_code == 400
|
||||
assert json_resp['result'] == 'error'
|
||||
assert json_resp['message'] == ['Firetext callback failed: reference missing']
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
|
||||
def test_firetext_callback_should_return_400_if_no_status(client, mocker):
|
||||
data = 'mobile=441234123123&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 == 400
|
||||
assert json_resp['result'] == 'error'
|
||||
assert json_resp['message'] == ['Firetext callback failed: status missing']
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
|
||||
def test_firetext_callback_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=0&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(
|
||||
['0', 'notification_id', 'Firetext', None],
|
||||
queue='sms-callbacks',
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Firetext removal")
|
||||
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',
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: MMG removal")
|
||||
def test_mmg_callback_should_not_need_auth(client, mocker, sample_notification):
|
||||
mocker.patch('app.notifications.notifications_sms_callback.process_sms_client_response')
|
||||
|
||||
@@ -262,7 +262,7 @@ def test_strip_leading_country_code(number, expected):
|
||||
["", [], 401],
|
||||
["testkey", [], 403],
|
||||
])
|
||||
def test_mmg_inbound_sms_auth(notify_db_session, notify_api, client, mocker, auth, keys, status_code):
|
||||
def test_sns_inbound_sms_auth(notify_db_session, notify_api, client, mocker, auth, keys, status_code):
|
||||
mocker.patch("app.notifications.receive_notifications.tasks.send_inbound_sms_to_service.apply_async")
|
||||
|
||||
create_service_with_inbound_number(
|
||||
|
||||
Reference in New Issue
Block a user