From 324a51c67e06b508424306affe283723f9937794 Mon Sep 17 00:00:00 2001 From: Gurdeep Atwal Date: Mon, 12 Feb 2024 11:23:49 +0000 Subject: [PATCH] add celery task --- api/cases/celery_tasks.py | 2 +- api/cases/tests/test_case_ecju_queries.py | 6 +++++- api/conf/celery.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) 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..22b763e952 100644 --- a/api/cases/tests/test_case_ecju_queries.py +++ b/api/cases/tests/test_case_ecju_queries.py @@ -1,4 +1,4 @@ -from api.conf import settings +from django.conf import settings import pytest import datetime from unittest import mock @@ -692,6 +692,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) 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), }, }