From 205a1da257287b54cecac6d48745f2af5947fa75 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Tue, 22 Oct 2024 14:14:36 -0700 Subject: [PATCH] add provider tasks tests --- tests/app/celery/test_provider_tasks.py | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/app/celery/test_provider_tasks.py b/tests/app/celery/test_provider_tasks.py index 1595d4504..a22a3fb93 100644 --- a/tests/app/celery/test_provider_tasks.py +++ b/tests/app/celery/test_provider_tasks.py @@ -98,6 +98,33 @@ def test_should_check_delivery_receipts_client_error(sample_notification, mocker mock_update.assert_called_once() +def test_should_check_delivery_receipts_ntfe(sample_notification, mocker): + mocker.patch("app.delivery.send_to_providers.send_sms_to_provider") + mocker.patch( + "app.celery.provider_tasks.aws_cloudwatch_client.is_localstack", + return_value=False, + ) + mock_update = mocker.patch( + "app.celery.provider_tasks.update_notification_status_by_id" + ) + mocker.patch( + "app.celery.provider_tasks.aws_cloudwatch_client.check_sms", + side_effect=NotificationTechnicalFailureException(), + ) + mock_sanitize = mocker.patch( + "app.celery.provider_tasks.sanitize_successful_notification_by_id" + ) + try: + check_sms_delivery_receipt( + "message_id", sample_notification.id, "2024-10-20 00:00:00+0:00" + ) + + assert 1 == 0 + except NotificationTechnicalFailureException: + mock_sanitize.assert_not_called() + mock_update.assert_called_once() + + def test_should_call_send_sms_to_provider_from_deliver_sms_task( sample_notification, mocker ):