From 44ce4951900e4bd318f64880bf4f4aa21306762f Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 10 Jan 2025 16:25:26 -0800 Subject: [PATCH] fix uuid --- .../app/notifications/test_process_notification.py | 8 ++++---- tests/app/organization/test_invite_rest.py | 2 +- .../send_notification/test_send_notification.py | 14 ++++++++++---- tests/app/service/test_rest.py | 2 +- .../app/service_invite/test_service_invite_rest.py | 2 +- tests/app/user/test_rest.py | 4 ++-- tests/app/user/test_rest_verify.py | 10 ++++++---- 7 files changed, 25 insertions(+), 17 deletions(-) diff --git a/tests/app/notifications/test_process_notification.py b/tests/app/notifications/test_process_notification.py index 296f68adf..06314ae75 100644 --- a/tests/app/notifications/test_process_notification.py +++ b/tests/app/notifications/test_process_notification.py @@ -263,7 +263,9 @@ def test_send_notification_to_queue( send_notification_to_queue(notification=notification, queue=requested_queue) - mocked.assert_called_once_with([str(notification.id)], queue=expected_queue, countdown=30) + mocked.assert_called_once_with( + [str(notification.id)], queue=expected_queue, countdown=30 + ) def test_send_notification_to_queue_throws_exception_deletes_notification( @@ -276,9 +278,7 @@ def test_send_notification_to_queue_throws_exception_deletes_notification( with pytest.raises(Boto3Error): send_notification_to_queue(sample_notification, False) mocked.assert_called_once_with( - [(str(sample_notification.id))], - queue="send-sms-tasks", - countdown=30 + [(str(sample_notification.id))], queue="send-sms-tasks", countdown=30 ) assert _get_notification_query_count() == 0 diff --git a/tests/app/organization/test_invite_rest.py b/tests/app/organization/test_invite_rest.py index 23a65dda1..bacab402d 100644 --- a/tests/app/organization/test_invite_rest.py +++ b/tests/app/organization/test_invite_rest.py @@ -73,7 +73,7 @@ def test_create_invited_org_user( # assert len(notification.personalisation["url"]) > len(expected_start_of_invite_url) mocked.assert_called_once_with( - [(str(notification.id))], queue="notify-internal-tasks", countdown=30 + [(str(notification.id))], queue="notify-internal-tasks", countdown=30 ) diff --git a/tests/app/service/send_notification/test_send_notification.py b/tests/app/service/send_notification/test_send_notification.py index d0b49a982..80f14a9c8 100644 --- a/tests/app/service/send_notification/test_send_notification.py +++ b/tests/app/service/send_notification/test_send_notification.py @@ -150,7 +150,9 @@ def test_send_notification_with_placeholders_replaced( {"template_version": sample_email_template_with_placeholders.version} ) - mocked.assert_called_once_with([notification_id], queue="send-email-tasks", countdown=30) + mocked.assert_called_once_with( + [notification_id], queue="send-email-tasks", countdown=30 + ) assert response.status_code == 201 assert response_data["body"] == "Hello Jo\nThis is an email from GOV.UK" assert response_data["subject"] == "Jo" @@ -420,7 +422,9 @@ def test_should_allow_valid_sms_notification(notify_api, sample_template, mocker response_data = json.loads(response.data)["data"] notification_id = response_data["notification"]["id"] - mocked.assert_called_once_with([notification_id], queue="send-sms-tasks", countdown=30) + mocked.assert_called_once_with( + [notification_id], queue="send-sms-tasks", countdown=30 + ) assert response.status_code == 201 assert notification_id assert "subject" not in response_data @@ -853,7 +857,7 @@ def test_should_delete_notification_and_return_error_if_redis_fails( ) assert str(e.value) == "failed to talk to redis" - mocked.assert_called_once_with([fake_uuid], queue=queue_name) + mocked.assert_called_once_with([fake_uuid], queue=queue_name, countdown=30) assert not notifications_dao.get_notification_by_id(fake_uuid) assert not NotificationHistory.query.get(fake_uuid) @@ -1185,7 +1189,9 @@ def test_should_allow_store_original_number_on_sms_notification( response_data = json.loads(response.data)["data"] notification_id = response_data["notification"]["id"] - mocked.assert_called_once_with([notification_id], queue="send-sms-tasks", countdown=30) + mocked.assert_called_once_with( + [notification_id], queue="send-sms-tasks", countdown=30 + ) assert response.status_code == 201 assert notification_id notifications = Notification.query.all() diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index 132de48e9..2b2472ad7 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -3025,7 +3025,7 @@ def test_verify_reply_to_email_address_should_send_verification_email( assert notification.template_id == verify_reply_to_address_email_template.id assert response["data"] == {"id": str(notification.id)} mocked.assert_called_once_with( - [str(notification.id)], queue="notify-internal-tasks" + [str(notification.id)], queue="notify-internal-tasks", countdown=30 ) assert ( notification.reply_to_text diff --git a/tests/app/service_invite/test_service_invite_rest.py b/tests/app/service_invite/test_service_invite_rest.py index 61b8b79e7..c43b2e878 100644 --- a/tests/app/service_invite/test_service_invite_rest.py +++ b/tests/app/service_invite/test_service_invite_rest.py @@ -90,7 +90,7 @@ def test_create_invited_user( ) mocked.assert_called_once_with( - [(str(notification.id))], queue="notify-internal-tasks" + [(str(notification.id))], queue="notify-internal-tasks", countdown=30 ) diff --git a/tests/app/user/test_rest.py b/tests/app/user/test_rest.py index f1ea5041b..860e2b10b 100644 --- a/tests/app/user/test_rest.py +++ b/tests/app/user/test_rest.py @@ -664,7 +664,7 @@ def test_send_already_registered_email( stmt = select(Notification) notification = db.session.execute(stmt).scalars().first() mocked.assert_called_once_with( - ([str(notification.id)]), queue="notify-internal-tasks" + ([str(notification.id)]), queue="notify-internal-tasks", countdown=30 ) assert ( notification.reply_to_text @@ -703,7 +703,7 @@ def test_send_user_confirm_new_email_returns_204( stmt = select(Notification) notification = db.session.execute(stmt).scalars().first() mocked.assert_called_once_with( - ([str(notification.id)]), queue="notify-internal-tasks" + ([str(notification.id)]), queue="notify-internal-tasks", countdown=30 ) assert ( notification.reply_to_text diff --git a/tests/app/user/test_rest_verify.py b/tests/app/user/test_rest_verify.py index d32d923bf..805d90a8e 100644 --- a/tests/app/user/test_rest_verify.py +++ b/tests/app/user/test_rest_verify.py @@ -231,7 +231,7 @@ def test_send_user_sms_code(client, sample_user, sms_code_template, mocker): assert notification.reply_to_text == notify_service.get_default_sms_sender() app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with( - ([str(notification.id)]), queue="notify-internal-tasks" + ([str(notification.id)]), queue="notify-internal-tasks", countdown=30 ) @@ -267,7 +267,7 @@ def test_send_user_code_for_sms_with_optional_to_field( notification = Notification.query.first() assert notification.to == "1" app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with( - ([str(notification.id)]), queue="notify-internal-tasks" + ([str(notification.id)]), queue="notify-internal-tasks", countdown=30 ) @@ -349,7 +349,7 @@ def test_send_new_user_email_verification( notification = Notification.query.first() assert _get_verify_code_count() == 0 mocked.assert_called_once_with( - ([str(notification.id)]), queue="notify-internal-tasks" + ([str(notification.id)]), queue="notify-internal-tasks", countdown=30 ) assert ( notification.reply_to_text @@ -494,7 +494,9 @@ def test_send_user_email_code( ) assert noti.to == "1" assert str(noti.template_id) == current_app.config["EMAIL_2FA_TEMPLATE_ID"] - deliver_email.assert_called_once_with([str(noti.id)], queue="notify-internal-tasks") + deliver_email.assert_called_once_with( + [str(noti.id)], queue="notify-internal-tasks", countdown=30 + ) @pytest.mark.skip(reason="Broken email functionality")