- resolver (rules RTC-R0..R4/A1..A3/G1..G2) over the official cClassTrib table 2026-06-22 and LC 214/2025 annexes; local vs official catalog comparison - ONE root-cause RTC blocker per product (missing/unresolved/ambiguous/conflict/official mismatch/catalog outdated/evidence missing) - auto-apply: C000025.CCLASSTRIB only, three switches (FIREBIRD_WRITES + RTC_AUTO_APPLY_ENABLED + Hub authorization), per-product re-read and re-decision, never overwrites, rowcount 1, audit table rtc_write_audits (migration 0027) - copy-only write E2E (280/280 applied, only CCLASSTRIB changed, 2nd run 0 writes, stale decision 0 writes); real databases untouched - docs: cclasstrib_resolution, rtc_auto_apply, unified_fiscal_completeness Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
from fastapi.testclient import TestClient
|
|
|
|
from central.app.main import create_app
|
|
|
|
|
|
def test_health_reports_database_dependency():
|
|
client = TestClient(create_app(database_probe=lambda: True))
|
|
|
|
assert client.get("/health").json() == {"status": "ok"}
|
|
|
|
|
|
def test_health_is_unavailable_when_database_is_down():
|
|
client = TestClient(create_app(database_probe=lambda: False))
|
|
|
|
assert client.get("/health").status_code == 503
|
|
|
|
|
|
def test_version_endpoint_reports_release_and_fiscal_versions():
|
|
body = TestClient(create_app(database_probe=lambda: True)).get("/version").json()
|
|
assert body["version"] == "1.1.9" and body["api_compat"] == "1.0" and body["engine_version"] and body["decision_version"]
|
|
|
|
|
|
def test_production_refuses_the_dev_token(monkeypatch):
|
|
import pytest
|
|
from central.app import main as main_module
|
|
monkeypatch.setattr(main_module.settings.__class__, "environment", "production", raising=False) if False else None
|
|
monkeypatch.setattr(main_module, "settings", type("S", (), {"environment": "production", "agent_dev_token": "dev", "log_level": "INFO"})())
|
|
with pytest.raises(RuntimeError):
|
|
create_app(database_probe=lambda: True)
|