This commit is contained in:
Shubhankar45
2026-10-27 12:03:31 +00:00
parent 2ed3945b5d
commit 4e5e95775d
104 changed files with 5210 additions and 606 deletions
+12 -4
View File
@@ -11,6 +11,7 @@ from zoneinfo import ZoneInfo
import pytest
from app.common.enums import ReportType
from app.common.exceptions import ValidationError
from app.reports import service as svc
@@ -36,7 +37,7 @@ def _service() -> svc.DCRService:
def _report(day: date) -> SimpleNamespace:
return SimpleNamespace(report_date=day)
return SimpleNamespace(report_date=day, report_type=ReportType.ACTUAL)
class TestVisitTime:
@@ -57,12 +58,19 @@ class TestVisitTime:
class TestReportDate:
def test_today_is_todays_ist_date_just_after_midnight(self, at):
at(2026, 9, 21, 1, 0) # still 20 Sep in UTC
_service()._validate_report_date(date(2026, 9, 21))
_service()._validate_report_date(date(2026, 9, 21), ReportType.ACTUAL)
def test_tomorrow_is_rejected(self, at):
def test_tomorrow_is_rejected_for_a_done_or_self_report(self, at):
at(2026, 9, 21, 1, 0)
for report_type in (ReportType.ACTUAL, ReportType.SELF):
with pytest.raises(ValidationError):
_service()._validate_report_date(date(2026, 9, 22), report_type)
def test_a_plan_may_be_made_up_to_two_days_ahead(self, at):
at(2026, 9, 21, 1, 0)
_service()._validate_report_date(date(2026, 9, 23), ReportType.PLAN)
with pytest.raises(ValidationError):
_service()._validate_report_date(date(2026, 9, 22))
_service()._validate_report_date(date(2026, 9, 24), ReportType.PLAN)
def test_local_helpers_use_the_configured_timezone():