From 85e100febe51e04d1a0e83b062f62f117ba80b30 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 13 Dec 2024 17:40:28 -0800 Subject: [PATCH] fix --- tests/app/clients/test_aws_cloudwatch.py | 46 ------------------------ 1 file changed, 46 deletions(-) diff --git a/tests/app/clients/test_aws_cloudwatch.py b/tests/app/clients/test_aws_cloudwatch.py index b9529037b..fce0e150c 100644 --- a/tests/app/clients/test_aws_cloudwatch.py +++ b/tests/app/clients/test_aws_cloudwatch.py @@ -2,7 +2,6 @@ import pytest from flask import current_app from app import aws_cloudwatch_client -from app.utils import utc_now def test_check_sms_no_event_error_condition(notify_api, mocker): @@ -74,51 +73,6 @@ def test_warn_if_dev_is_opted_out(response, notify_id, expected_message): assert result == expected_message -def test_check_sms_success(notify_api, mocker): - aws_cloudwatch_client.init_app(current_app) - boto_mock = mocker.patch.object(aws_cloudwatch_client, "_client", create=True) - boto_mock.filter_log_events.side_effect = side_effect - mocker.patch.dict( - "os.environ", - {"SES_DOMAIN_ARN": "arn:aws:ses:us-west-2:12345:identity/ses-xxx.xxx.xxx.xxx"}, - ) - - message_id = "succeed" - notification_id = "ccc" - created_at = utc_now() - with notify_api.app_context(): - aws_cloudwatch_client.check_sms(message_id, notification_id, created_at) - - # We check the 'success' log group first and if we find the message_id, we are done, so there is only 1 call - assert boto_mock.filter_log_events.call_count == 1 - mock_call = str(boto_mock.filter_log_events.mock_calls[0]) - assert "Failure" not in mock_call - assert "succeed" in mock_call - assert "notification.messageId" in mock_call - - -def test_check_sms_failure(notify_api, mocker): - aws_cloudwatch_client.init_app(current_app) - boto_mock = mocker.patch.object(aws_cloudwatch_client, "_client", create=True) - boto_mock.filter_log_events.side_effect = side_effect - mocker.patch.dict( - "os.environ", - {"SES_DOMAIN_ARN": "arn:aws:ses:us-west-2:12345:identity/ses-xxx.xxx.xxx.xxx"}, - ) - message_id = "fail" - notification_id = "bbb" - created_at = utc_now() - with notify_api.app_context(): - aws_cloudwatch_client.check_sms(message_id, notification_id, created_at) - - # We check the 'success' log group and find nothing, so we then check the 'fail' log group -- two calls. - assert boto_mock.filter_log_events.call_count == 2 - mock_call = str(boto_mock.filter_log_events.mock_calls[1]) - assert "Failure" in mock_call - assert "fail" in mock_call - assert "notification.messageId" in mock_call - - def test_extract_account_number_gov_cloud(): domain_arn = "arn:aws-us-gov:ses:us-gov-west-1:12345:identity/ses-abc.xxx.xxx.xxx" actual_account_number = aws_cloudwatch_client._extract_account_number(domain_arn)