receive notifications

This commit is contained in:
Kenneth Kehl
2024-11-11 12:34:07 -08:00
parent 78f010ffa2
commit 194df023d7
2 changed files with 18 additions and 3 deletions

View File

@@ -277,7 +277,7 @@
"filename": "tests/app/notifications/test_receive_notification.py", "filename": "tests/app/notifications/test_receive_notification.py",
"hashed_secret": "913a73b565c8e2c8ed94497580f619397709b8b6", "hashed_secret": "913a73b565c8e2c8ed94497580f619397709b8b6",
"is_verified": false, "is_verified": false,
"line_number": 24, "line_number": 25,
"is_secret": false "is_secret": false
}, },
{ {
@@ -285,7 +285,7 @@
"filename": "tests/app/notifications/test_receive_notification.py", "filename": "tests/app/notifications/test_receive_notification.py",
"hashed_secret": "d70eab08607a4d05faa2d0d6647206599e9abc65", "hashed_secret": "d70eab08607a4d05faa2d0d6647206599e9abc65",
"is_verified": false, "is_verified": false,
"line_number": 54, "line_number": 55,
"is_secret": false "is_secret": false
} }
], ],
@@ -384,5 +384,5 @@
} }
] ]
}, },
"generated_at": "2024-11-11T16:49:37Z" "generated_at": "2024-11-11T20:34:04Z"
} }

View File

@@ -11,6 +11,7 @@ from app.notifications.receive_notifications import (
create_inbound_sms_object, create_inbound_sms_object,
fetch_potential_service, fetch_potential_service,
has_inbound_sms_permissions, has_inbound_sms_permissions,
receive_sns_sms,
unescape_string, unescape_string,
) )
from tests.app.db import ( from tests.app.db import (
@@ -369,3 +370,17 @@ def test_fetch_potential_service_cant_find_it(mock_dao):
mock_dao.return_value = create_service() mock_dao.return_value = create_service()
found_service = fetch_potential_service(234, "sns") found_service = fetch_potential_service(234, "sns")
assert found_service is False assert found_service is False
def test_receive_sns_sms_inbound_disabled(mocker):
mocker.patch(
"app.notifications.receive_notifications.current_app.config",
{"RECEIVE_INBOUND_SMS": False},
)
response, status_code = receive_sns_sms()
assert status_code == 200
assert response.json == {
"result": "success",
"message": "SMS-SNS callback succeeded",
}