Skip to content

Commit

Permalink
[#190] add notification_id param to contact_information_tasks and do …
Browse files Browse the repository at this point in the history
…not cast it to a string
  • Loading branch information
marisahoenig committed Oct 28, 2020
1 parent e461040 commit bd03a59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/celery/contact_information_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
2 changes: 1 addition & 1 deletion app/notifications/process_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions tests/app/celery/test_contact_information_tasks.py
Original file line number Diff line number Diff line change
@@ -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.')

0 comments on commit bd03a59

Please sign in to comment.