try fixing tests

This commit is contained in:
Kenneth Kehl
2024-10-01 11:45:52 -07:00
parent f55c437c7d
commit b7a6f4a3ba

View File

@@ -201,7 +201,7 @@ def test_should_not_send_sms_message_when_service_is_inactive_notification_is_in
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
with pytest.raises(NotificationTechnicalFailureException) as e:
send_to_providers.send_sms_to_provider(sample_notification)
@@ -232,7 +232,7 @@ def test_send_sms_should_use_template_version_from_notification_not_latest(
mock_s3_p = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_s3_p.return_value = {}
mock_s3_p.return_value = {"ignore": "ignore"}
mocker.patch("app.aws_sns_client.send_sms")
@@ -286,7 +286,7 @@ def test_should_have_sending_status_if_fake_callback_function_fails(
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
sample_notification.key_type = KeyType.TEST
with pytest.raises(HTTPError):
@@ -311,7 +311,7 @@ def test_should_not_send_to_provider_when_status_is_not_created(
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
send_to_providers.send_sms_to_provider(notification)
@@ -376,7 +376,7 @@ def test_send_sms_should_use_service_sms_sender(
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
send_to_providers.send_sms_to_provider(
db_notification,
@@ -408,7 +408,7 @@ def test_send_email_to_provider_should_not_send_to_provider_when_status_is_not_c
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
send_to_providers.send_sms_to_provider(notification)
app.aws_ses_client.send_email.assert_not_called()
app.delivery.send_to_providers.send_email_response.assert_not_called()
@@ -672,7 +672,7 @@ def test_should_set_notification_billable_units_and_reduces_provider_priority_if
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
# flake8 no longer likes raises with a generic exception
try:
@@ -707,7 +707,7 @@ def test_should_send_sms_to_international_providers(
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
send_to_providers.send_sms_to_provider(notification_international)
@@ -753,7 +753,7 @@ def test_should_handle_sms_sender_and_prefix_message(
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
send_to_providers.send_sms_to_provider(notification)
@@ -814,7 +814,7 @@ def test_send_sms_to_provider_should_use_normalised_to(mocker, client, sample_te
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore": "ignore"}
send_to_providers.send_sms_to_provider(notification)
send_mock.assert_called_once_with(
to="12028675309",
@@ -894,7 +894,7 @@ def test_send_sms_to_provider_should_return_template_if_found_in_redis(
mock_personalisation = mocker.patch(
"app.delivery.send_to_providers.get_personalisation_from_s3"
)
mock_personalisation.return_value = {}
mock_personalisation.return_value = {"ignore: ignore"}
send_to_providers.send_sms_to_provider(notification)
assert mock_get_template.called is False