Files
awoooi/apps/api/tests/test_incident_timeline_service.py
Your Name 4a57c2d04f
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 10m56s
feat(flywheel): expose incident processing timeline
2026-04-29 23:38:30 +08:00

26 lines
764 B
Python

from src.services.incident_timeline_service import STAGE_DEFS, format_ascii_timeline
def _stages(status_by_stage: dict[str, str]) -> list[dict]:
return [
{"stage": stage, "status": status_by_stage.get(stage, "skipped")}
for stage, _label in STAGE_DEFS
]
def test_format_ascii_timeline_skips_unrecorded_stages() -> None:
stages = _stages({
"webhook": "completed",
"ai_router": "success",
"executor": "error",
"km": "pending",
})
assert format_ascii_timeline(stages) == (
"webhook:ok > ai_router:ok > executor:fail > km:wait"
)
def test_format_ascii_timeline_has_empty_fallback() -> None:
assert format_ascii_timeline(_stages({})) == "webhook:skip > ai:skip > executor:skip"