test_q4b_ui_integration.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
13 hours ago
| 1 | """Integration tests for Track Q / Q4b Path B UI redesign (§Q4A.15).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import urllib.request |
| 6 | from pathlib import Path |
| 7 | |
| 8 | from tests.fixtures.app import seed_app_repo, start_test_app |
| 9 | |
| 10 | DIAGRAMS = ( |
| 11 | "lanes.svg", |
| 12 | "regimes.svg", |
| 13 | "layers.svg", |
| 14 | "kit-consumer.svg", |
| 15 | ) |
| 16 | |
| 17 | |
| 18 | def test_redesigned_static_and_diagrams_served(tmp_path: Path) -> None: |
| 19 | seed_app_repo(tmp_path) |
| 20 | handle, client = start_test_app(tmp_path) |
| 21 | try: |
| 22 | status, health = client.get("/api/health") |
| 23 | assert status == 200 |
| 24 | assert health["ok"] is True |
| 25 | |
| 26 | request = urllib.request.Request( |
| 27 | f"{client.base_url}/", |
| 28 | headers={"Authorization": f"Bearer {client.session}"}, |
| 29 | ) |
| 30 | with urllib.request.urlopen(request, timeout=5) as response: |
| 31 | html = response.read().decode("utf-8") |
| 32 | assert "Overseer Kit" in html |
| 33 | assert 'data-tab="overview"' in html |
| 34 | assert "/assets/diagrams/lanes.svg" in html |
| 35 | |
| 36 | for name in DIAGRAMS: |
| 37 | svg_req = urllib.request.Request( |
| 38 | f"{client.base_url}/assets/diagrams/{name}", |
| 39 | headers={"Authorization": f"Bearer {client.session}"}, |
| 40 | ) |
| 41 | with urllib.request.urlopen(svg_req, timeout=5) as response: |
| 42 | assert response.status == 200 |
| 43 | body = response.read() |
| 44 | assert b"<svg" in body |
| 45 | |
| 46 | status_code, status_payload = client.get("/api/status") |
| 47 | assert status_code == 200 |
| 48 | assert status_payload["result"]["initialized"] is True |
| 49 | |
| 50 | unknown, payload = client.get("/api/does-not-exist") |
| 51 | assert unknown == 404 |
| 52 | assert payload["error"] == "not_found" |
| 53 | finally: |
| 54 | handle.shutdown() |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
13 hours ago