diff --git a/api/cases/celery_tasks.py b/api/cases/celery_tasks.py index a667619f0d..19fb68b174 100644 --- a/api/cases/celery_tasks.py +++ b/api/cases/celery_tasks.py @@ -172,7 +172,7 @@ def schedule_all_ecju_query_chaser_emails(): """ Sends an ECJU 15 working days reminder Runs as a background task daily at a given time. - Doesn't run on non-working days (bank-holidays & weekends) + Can accommodate reruns and can send reminders if any have been missed upto 20 days after ECJU Query created """ logger.info("Sending all ECJU query chaser emails started") diff --git a/api/cases/tests/test_case_ecju_queries.py b/api/cases/tests/test_case_ecju_queries.py index bee95f36cf..b9aab756e9 100644 --- a/api/cases/tests/test_case_ecju_queries.py +++ b/api/cases/tests/test_case_ecju_queries.py @@ -1,4 +1,5 @@ -from api.conf import settings +from django.conf import settings +from api.core.helpers import get_exporter_frontend_url import pytest import datetime from unittest import mock @@ -692,6 +693,10 @@ class ECJUQueriesChaserNotificationTests(DataTestClient): def setUp(self): super().setUp() settings.GOV_NOTIFY_ENABLED = True + # Require a valid formatted key else NotificationsAPIClient will complain with missing service id key. + settings.GOV_NOTIFY_KEY = ( + "faketestkey-aa1539a1-0ba4-4ac2-b6ff-ae557aed2169-aa1539a1-0ba4-4ac2-b6ff-ae557aed2169" + ) self.case = self.create_standard_application_case(self.organisation) self.date_15_working_days_from_today = datetime.datetime(2024, 1, 16, 12, 00) @@ -811,9 +816,10 @@ def test_schedule_all_ecju_query_chaser_emails_send_mail_params(self, mock_send_ schedule_all_ecju_query_chaser_emails.apply() mock_send_email.assert_called_once() + expected_payload = ExporterECJUQueryChaser( case_reference=self.case.reference_code, - exporter_frontend_ecju_queries_url=f"https://exporter.lite.service.localhost.uktrade.digital/applications/{self.case.pk}/ecju-queries/", + exporter_frontend_ecju_queries_url=get_exporter_frontend_url(f"/applications/{self.case.pk}/ecju-queries/"), remaining_days=5, ) mock_send_email.assert_called_with( diff --git a/api/conf/celery.py b/api/conf/celery.py index 286d5769d1..c9e88ce463 100644 --- a/api/conf/celery.py +++ b/api/conf/celery.py @@ -29,6 +29,6 @@ }, "send ecju query chaser emails 8pm, 4pm": { "task": "api.cases.celery_tasks.schedule_all_ecju_query_chaser_emails", - "schedule": crontab(hour="8, 16", minute=0), + "schedule": crontab(hour="8, 12, 13, 15 ,16", minute=0), }, }