- uv(workspace) + pnpm monorepo;docker-compose(pg+api+web) - SQLAlchemy 16 MVP 表 + Alembic 初版迁移(无漂移,users stub) - FastAPI 骨架:统一错误信封(带 request_id) + structlog + /jobs/:id + OpenAPI - Next.js 骨架:纸感主题 token + OpenAPI→TS 客户端代码生成(gen:api) - CI(ruff/mypy/pytest + pg service + alembic 漂移校验) - 四份设计规格(PRODUCT/UX/ARCHITECTURE/DEV_PLAN) + CLAUDE.md
25 lines
752 B
Python
25 lines
752 B
Python
from __future__ import annotations
|
|
|
|
import httpx
|
|
|
|
|
|
async def test_root_returns_ok(client: httpx.AsyncClient) -> None:
|
|
resp = await client.get("/")
|
|
assert resp.status_code == 200
|
|
assert resp.json()["status"] == "ok"
|
|
|
|
|
|
async def test_health_endpoint(client: httpx.AsyncClient) -> None:
|
|
resp = await client.get("/health")
|
|
assert resp.status_code == 200
|
|
|
|
|
|
async def test_response_carries_request_id_header(client: httpx.AsyncClient) -> None:
|
|
resp = await client.get("/health")
|
|
assert resp.headers.get("x-request-id")
|
|
|
|
|
|
async def test_propagates_incoming_request_id(client: httpx.AsyncClient) -> None:
|
|
resp = await client.get("/health", headers={"x-request-id": "abc123"})
|
|
assert resp.headers["x-request-id"] == "abc123"
|