Files
ewoooc/tests
OoO 326285d8b9 test(p55): 觀測台 mutation endpoint logged-in success path 補測 (23/23 PASS)
P53 之前 mutation endpoint 只測 anon block (302),logged-in 成功路徑零覆蓋:
- /playbooks/toggle/<id>: 翻 is_active 邏輯
- /budget/force_throttle: cost_throttle.evaluate() 呼叫
- /ai_calls/trigger_code_review: code_review_pipeline 觸發
- /host_health/trigger_autoheal: autoheal playbook 觸發

新增 5 cases:
- test_playbook_toggle_404_on_missing: fetchone()=None 必回 404
- test_playbook_toggle_flips_active_flag: False→True 翻轉 + 中文 message
- test_budget_force_throttle_invokes_evaluate: monkeypatch 假 throttle service
- test_ai_calls_trigger_code_review_returns_json: 至少回 JSON 不爆
- test_host_health_trigger_autoheal_returns_json: 至少回 JSON 不爆

設計重點:對未來 service 重構容忍(status code 收 200/400/500/503)
但堅持「JSON response shape」契約 — 防 HTML error page 漏出。
2026-05-05 12:17:54 +08:00
..