diff --git a/core/tests/test_celery_tasks.py b/core/tests/test_celery_tasks.py index f4011843..dd0e6d15 100644 --- a/core/tests/test_celery_tasks.py +++ b/core/tests/test_celery_tasks.py @@ -1,6 +1,12 @@ +from datetime import timedelta + +from django.conf import settings +from django.utils import timezone from rest_framework.test import APITestCase from core import celery_tasks +from mail.enums import ReplyStatusEnum +from mail.models import Mail class FlagsUpdateTest(APITestCase): @@ -10,3 +16,14 @@ def test_debug_add(self): def test_debug_exception(self): self.assertRaises(Exception, celery_tasks.debug_exception) + + def test_debug_count_mail(self): + sent_at = timezone.now() - timedelta(seconds=settings.EMAIL_AWAITING_REPLY_TIME) + Mail.objects.create( + edi_filename="filename", + edi_data="1\\fileHeader\\CHIEF\\SPIRE\\", + status=ReplyStatusEnum.PENDING, + sent_at=sent_at, + ) + res = celery_tasks.debug_count_mail() + assert res == 1