diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 7b5717b66..57a7c5bc8 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -31,7 +31,6 @@ from app import ( from app.aws import s3 from app.celery import provider_tasks from app.celery import letters_pdf_tasks -from app.celery.service_callback_tasks import send_delivery_status_to_service from app.config import QueueNames from app.dao.inbound_sms_dao import dao_get_inbound_sms_by_id from app.dao.jobs_dao import ( @@ -46,13 +45,11 @@ from app.dao.notifications_dao import ( dao_update_notifications_for_job_to_sent_to_dvla, dao_update_notifications_by_reference, dao_get_last_notification_added_for_job_id, - dao_get_notifications_by_references, ) from app.dao.provider_details_dao import get_current_provider from app.dao.service_inbound_api_dao import get_service_inbound_api_for_service from app.dao.services_dao import dao_fetch_service_by_id, fetch_todays_total_message_count from app.dao.templates_dao import dao_get_template_by_id -from app.dao.service_callback_api_dao import get_service_callback_api_for_service from app.models import ( DVLA_RESPONSE_STATUS_SENT, EMAIL_TYPE, @@ -416,12 +413,6 @@ def update_letter_notifications_to_error(self, notification_references): ) current_app.logger.info("Updated {} letter notifications to technical-failure".format(updated_count)) - notifications = dao_get_notifications_by_references(references=notification_references) - # queue callback task only if the service_callback_api exists - service_callback_api = get_service_callback_api_for_service(service_id=notifications[0].service_id) - if service_callback_api: - for notification in notifications: - send_delivery_status_to_service.apply_async([str(notification.id)], queue=QueueNames.CALLBACKS) def create_dvla_file_contents_for_job(job_id): @@ -503,12 +494,6 @@ def update_letter_notifications_statuses(self, filename): current_app.logger.info( 'DVLA file: {filename}, notification updated to {status}: {reference}'.format( filename=filename, status=status, reference=str(update.reference))) - notifications = dao_get_notifications_by_references(references=[update.reference]) - # queue callback task only if the service_callback_api exists - service_callback_api = get_service_callback_api_for_service(service_id=notifications[0].service_id) - if service_callback_api: - for notification in notifications: - send_delivery_status_to_service.apply_async([str(notification.id)], queue=QueueNames.CALLBACKS) def process_updates_from_file(response_file): diff --git a/tests/app/celery/test_ftp_update_tasks.py b/tests/app/celery/test_ftp_update_tasks.py index cf3e90ade..880189297 100644 --- a/tests/app/celery/test_ftp_update_tasks.py +++ b/tests/app/celery/test_ftp_update_tasks.py @@ -23,7 +23,6 @@ from app.celery.tasks import ( from tests.app.db import create_notification, create_service_callback_api from tests.conftest import set_config -from unittest.mock import call def test_update_job_to_sent_to_dvla(sample_letter_template, sample_letter_job): @@ -103,10 +102,6 @@ def test_update_letter_notifications_statuses_persisted(notify_api, mocker, samp sent_letter.reference, failed_letter.reference) mocker.patch('app.celery.tasks.s3.get_s3_file', return_value=valid_file) - send_mock = mocker.patch( - 'app.celery.service_callback_tasks.send_delivery_status_to_service.apply_async' - ) - update_letter_notifications_statuses(filename='foo.txt') assert sent_letter.status == NOTIFICATION_DELIVERED @@ -116,10 +111,6 @@ def test_update_letter_notifications_statuses_persisted(notify_api, mocker, samp assert failed_letter.billable_units == 2 assert failed_letter.updated_at - calls = [call([str(failed_letter.id)], queue="service-callbacks"), - call([str(sent_letter.id)], queue="service-callbacks")] - send_mock.assert_has_calls(calls, any_order=True) - def test_update_letter_notifications_does_not_call_send_callback_if_no_db_entry(notify_api, mocker, sample_letter_template): @@ -159,9 +150,6 @@ def test_update_letter_notifications_to_error_updates_based_on_notification_refe sample_letter_template, mocker ): - send_mock = mocker.patch( - 'app.celery.service_callback_tasks.send_delivery_status_to_service.apply_async' - ) first = create_notification(sample_letter_template, reference='first ref') second = create_notification(sample_letter_template, reference='second ref') create_service_callback_api(service=sample_letter_template.service, url="https://original_url.com") @@ -174,4 +162,3 @@ def test_update_letter_notifications_to_error_updates_based_on_notification_refe assert first.sent_at is None assert first.updated_at == dt assert second.status == NOTIFICATION_CREATED - assert send_mock.called