From bd03a59f9f21579c4135e5800299385dee9fdaae Mon Sep 17 00:00:00 2001 From: Marisa Hoenig Date: Wed, 28 Oct 2020 13:13:42 -0400 Subject: [PATCH] [#190] add notification_id param to contact_information_tasks and do not cast it to a string --- app/celery/contact_information_tasks.py | 4 ++-- app/notifications/process_notifications.py | 2 +- tests/app/celery/test_contact_information_tasks.py | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/celery/contact_information_tasks.py b/app/celery/contact_information_tasks.py index 5808956233..84a3d43d9a 100644 --- a/app/celery/contact_information_tasks.py +++ b/app/celery/contact_information_tasks.py @@ -7,11 +7,11 @@ @notify_celery.task(name="lookup-contact-info-tasks") @statsd(namespace="tasks") -def lookup_contact_info(): +def lookup_contact_info(notification_id): current_app.logger.info("This task will look up contact information.") @notify_celery.task(name="lookup-va-profile-id-tasks") @statsd(namespace="tasks") -def lookup_va_profile_id(): +def lookup_va_profile_id(notification_id): current_app.logger.info("This task will look up VA Profile ID.") diff --git a/app/notifications/process_notifications.py b/app/notifications/process_notifications.py index a4b922cda5..f83a61edc0 100644 --- a/app/notifications/process_notifications.py +++ b/app/notifications/process_notifications.py @@ -169,7 +169,7 @@ def send_to_queue_for_recipient_info_based_on_recipient_identifier(notification, task = contact_information_tasks.lookup_va_profile_id try: - task.apply_async([str(notification.id)], queue=queue) + task.apply_async([notification.id], queue=queue) except Exception: dao_delete_notification_by_id(notification.id) raise diff --git a/tests/app/celery/test_contact_information_tasks.py b/tests/app/celery/test_contact_information_tasks.py index 70d946d2be..44a3418966 100644 --- a/tests/app/celery/test_contact_information_tasks.py +++ b/tests/app/celery/test_contact_information_tasks.py @@ -1,11 +1,14 @@ +import uuid + from app.celery.contact_information_tasks import lookup_contact_info, lookup_va_profile_id def test_should_log_message_for_contact_information_tasks(client, mocker): mock_logger = mocker.patch('app.celery.contact_information_tasks.current_app.logger.info') + notification_id = uuid.uuid4() - lookup_contact_info() + lookup_contact_info(notification_id) mock_logger.assert_called_with('This task will look up contact information.') - lookup_va_profile_id() + lookup_va_profile_id(notification_id) mock_logger.assert_called_with('This task will look up VA Profile ID.')