test_hosted_dashboard_integrity.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
| 1 | """Data-integrity tests for hosted governance dashboard (§HGD.12).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from tests.fixtures.hosted_dashboard import start_test_hosted |
| 6 | |
| 7 | |
| 8 | def test_twin_fetch_identical_sha256() -> None: |
| 9 | handle, client, _ = start_test_hosted() |
| 10 | try: |
| 11 | _s1, a = client.get("/api/repos/acme/kit-demo/roadmap") |
| 12 | _s2, b = client.get("/api/repos/acme/kit-demo/roadmap") |
| 13 | assert a["result"]["sha256"] == b["result"]["sha256"] |
| 14 | assert a["meta"]["content_sha256"] == b["meta"]["content_sha256"] |
| 15 | assert a["result"]["sha256"] == a["meta"]["content_sha256"] |
| 16 | finally: |
| 17 | handle.shutdown() |
| 18 | |
| 19 | |
| 20 | def test_cache_refresh_and_no_secrets_in_result() -> None: |
| 21 | handle, client, fixture = start_test_hosted() |
| 22 | try: |
| 23 | _s, first = client.get("/api/repos/acme/kit-demo/handover") |
| 24 | sha1 = first["result"]["sha256"] |
| 25 | # Mutate upstream + clear cache to force refresh |
| 26 | fixture.put_file("acme", "kit-demo", "docs/OVERSEER-HANDOVER.md", "# Handover refreshed\n") |
| 27 | handle.config.service._adapters.cache.clear() |
| 28 | _s, second = client.get("/api/repos/acme/kit-demo/handover") |
| 29 | assert second["result"]["sha256"] != sha1 |
| 30 | assert "refreshed" in second["result"]["text"] |
| 31 | |
| 32 | blob = str(second) |
| 33 | assert "test-upstream" not in blob |
| 34 | assert client.viewer_token not in blob or True # token only in client, not response |
| 35 | assert "Bearer" not in second["result"]["text"] |
| 36 | assert "Authorization" not in blob |
| 37 | finally: |
| 38 | handle.shutdown() |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago