Skip to content

Commit

Permalink
added test for mail
Browse files Browse the repository at this point in the history
  • Loading branch information
Tllew committed Jan 9, 2024
1 parent ef8142c commit 9d1c564
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/tests/test_celery_tasks.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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

0 comments on commit 9d1c564

Please sign in to comment.