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
+29
View File
@@ -37,6 +37,7 @@ from app.users.models import User # noqa: E402
TABLES = [
"audit_log",
"product",
"missed_visit",
"doctor_call",
"chemist_call",
"daily_call_report",
@@ -169,6 +170,34 @@ async def org(db: AsyncSession) -> dict:
}
@pytest.fixture
async def approved_plan(db: AsyncSession, org: dict):
"""An empty day plan, already approved, so an end-of-day report may be filed.
For tests about end-of-day rules where the plan is incidental; the plan flow itself
is exercised through the API in tests/e2e/test_day_plan.py.
"""
from app.common.enums import DCRStatus, ReportType
from app.common.utils import utcnow
from app.reports.models import DailyCallReport
async def make(day: date | None = None, mr: str = "mr1") -> DailyCallReport:
plan = DailyCallReport(
id=uuid.uuid4(),
mr_user_id=org[mr].id,
headquarters_id=org[mr].headquarters_id,
report_date=day or date.today(),
report_type=ReportType.PLAN,
status=DCRStatus.APPROVED,
approved_at=utcnow(),
)
db.add(plan)
await db.commit()
return plan
return make
async def login(client: AsyncClient, user: User) -> dict[str, str]:
resp = await client.post(
"/api/v1/auth/login",