feat(ТСН): состояние базы для оператора (T12)

tsn_stage(): нет базы, битая, есть и что внутри. 8 проверок.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-18 02:36:13 +10:00
co-authored by Claude Code
parent 23344f9866
commit 174509a60b
2 changed files with 26 additions and 0 deletions
+9
View File
@@ -76,3 +76,12 @@ def test_fresh_db_has_no_findings(monkeypatch):
"x": {"extract_ok": True, "fetched_at": "2026-11-18T01:00:00Z"}}}})
findings, _ = ext_check.check_tsn_ref({})
assert findings == []
def test_tsn_stage_served_when_db_ok(monkeypatch):
import ext_status
monkeypatch.setattr(tsn_ref, "_problem_of", lambda path=None: None)
monkeypatch.setattr(tsn_ref, "verify_db", lambda p: {"ok": True, "works": 10, "values": 20})
monkeypatch.setattr(tsn_ref, "latest_release", lambda: {"built_at": "2026-11-18T00:00:00Z"})
st = ext_status.tsn_stage()
assert st["status"] == "served" and "10" in st["label"]