feat: FastAPI console with dashboard, Pulp client, healthz (stages 0-1)

- config: PULP_* env + 사내 CA(verify=) 대응
- pulp_client: Basic Auth get/post/patch, status/list_repos/get_version
- BFF 라우트: GET / (대시보드), GET /repos (조각), GET /healthz
- views: Pulp JSON → 표시 모델 (GPG 검증 배지 3단계, 요약 집계)
- HTMX + Jinja 템플릿, vendored pico.css/htmx.js (CDN 의존 0)
- 브라우저는 Pulp 직접 호출 안 함 — 모두 BFF 경유 (스펙 §2)
- 테스트: pulp_client(respx), 라우트(dependency_overrides), views 순수함수

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 10:55:01 +09:00
parent a91b9d0245
commit 3622b4f20a
21 changed files with 671 additions and 0 deletions

36
tests/test_healthz.py Normal file
View File

@@ -0,0 +1,36 @@
import httpx
from fastapi.testclient import TestClient
from app.main import app, get_pulp_client
client = TestClient(app)
class _FakeOnline:
def status(self):
return {"online": True}
class _FakeDown:
def status(self):
raise httpx.ConnectError("connection refused")
def test_healthz_online():
app.dependency_overrides[get_pulp_client] = lambda: _FakeOnline()
try:
resp = client.get("/healthz")
finally:
app.dependency_overrides.clear()
assert resp.status_code == 200
assert "연결됨" in resp.text
def test_healthz_offline_when_pulp_down():
app.dependency_overrides[get_pulp_client] = lambda: _FakeDown()
try:
resp = client.get("/healthz")
finally:
app.dependency_overrides.clear()
assert resp.status_code == 503
assert "연결 실패" in resp.text