feat: add public h5 dashboard and publish traceability
This commit is contained in:
@@ -9,7 +9,7 @@ import time
|
||||
import unittest
|
||||
from datetime import date, datetime
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Mapping
|
||||
from typing import Any, Dict, Mapping, Optional
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from arr_web.app import PortalApplication, RuntimeHealth, SessionLedger
|
||||
@@ -219,9 +219,22 @@ class CompanyReportCoordinatorTests(unittest.TestCase):
|
||||
now=lambda: datetime(2026, 8, 1, tzinfo=BANGKOK),
|
||||
)
|
||||
try:
|
||||
created = coordinator.create("2026-07", "11-20")
|
||||
source = {
|
||||
"source_batch_id": 7,
|
||||
"source_type": "excel",
|
||||
"filename": "Booking 报表.xlsx",
|
||||
"source_rows": 12,
|
||||
"worksheet_count": 2,
|
||||
"distinct_group_codes": 8,
|
||||
"room_quantity": 14,
|
||||
"activated_at": "2026-07-31T08:00:00+07:00",
|
||||
"disposition": "current",
|
||||
}
|
||||
created = coordinator.create("2026-07", "11-20", source=source)
|
||||
self.assertEqual(created["source"], source)
|
||||
job = wait_terminal(coordinator, created["job_id"])
|
||||
self.assertEqual(job["state"], "succeeded")
|
||||
self.assertEqual(job["source"], source)
|
||||
self.assertEqual(job["requested_companies"], list(COMPANY_NAMES))
|
||||
self.assertEqual(len(job["company_results"]), 5)
|
||||
self.assertEqual(job["company_results"][1]["warnings"][0]["record_ids"], [2])
|
||||
@@ -314,7 +327,7 @@ class CompanyReportCoordinatorTests(unittest.TestCase):
|
||||
|
||||
class FakeCompanyCoordinator:
|
||||
def __init__(self) -> None:
|
||||
self.created: list[tuple[str, str]] = []
|
||||
self.created: list[tuple[str, str, Optional[Mapping[str, Any]]]] = []
|
||||
self.listed: list[tuple[object, int, int]] = []
|
||||
self.descriptor = ArtifactDescriptor(
|
||||
"company_ten_day_xlsx",
|
||||
@@ -325,9 +338,15 @@ class FakeCompanyCoordinator:
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
)
|
||||
|
||||
def create(self, report_month: str, period: str) -> Dict[str, Any]:
|
||||
self.created.append((report_month, period))
|
||||
return {"job_id": "a" * 32, "state": "queued"}
|
||||
def create(
|
||||
self,
|
||||
report_month: str,
|
||||
period: str,
|
||||
*,
|
||||
source: Optional[Mapping[str, Any]] = None,
|
||||
) -> Dict[str, Any]:
|
||||
self.created.append((report_month, period, source))
|
||||
return {"job_id": "a" * 32, "state": "queued", "source": source}
|
||||
|
||||
def list_jobs(
|
||||
self,
|
||||
@@ -477,7 +496,11 @@ class CompanyReportRouteTests(unittest.TestCase):
|
||||
body,
|
||||
)
|
||||
self.assertEqual(response.status, 202)
|
||||
self.assertEqual(self.coordinator.created, [("2026-07", "01-10")])
|
||||
self.assertEqual(
|
||||
self.coordinator.created,
|
||||
[("2026-07", "01-10", self.booking_sources.source)],
|
||||
)
|
||||
self.assertEqual(decoded(response)["data"]["source"]["source_batch_id"], 7)
|
||||
invalid = self.app.handle(
|
||||
"POST",
|
||||
"/api/company-reports/jobs",
|
||||
|
||||
Reference in New Issue
Block a user