feat: 移除仓库内 nginx 并拆分前端运行时
This commit is contained in:
@@ -166,6 +166,21 @@ def create_app() -> FastAPI:
|
||||
|
||||
register_exception_handlers(app)
|
||||
|
||||
@app.get(
|
||||
"/",
|
||||
tags=["health"],
|
||||
summary="服务入口说明",
|
||||
description="返回后端服务入口说明,避免将根路径误认为前端页面。",
|
||||
)
|
||||
async def root() -> dict[str, str]:
|
||||
return {
|
||||
"service": "ctms-backend",
|
||||
"status": "ok",
|
||||
"health": "/health",
|
||||
"docs": "/docs",
|
||||
"api": "/api/v1",
|
||||
}
|
||||
|
||||
@app.get(
|
||||
"/health",
|
||||
tags=["health"],
|
||||
|
||||
@@ -62,6 +62,20 @@ async def test_register_creates_pending_user(client_and_db):
|
||||
assert user.status == UserStatus.PENDING
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_root_returns_service_metadata(client_and_db):
|
||||
client, _ = client_and_db
|
||||
resp = await client.get("/")
|
||||
assert resp.status_code == 200
|
||||
assert resp.json() == {
|
||||
"service": "ctms-backend",
|
||||
"status": "ok",
|
||||
"health": "/health",
|
||||
"docs": "/docs",
|
||||
"api": "/api/v1",
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_login_blocked_before_approval(client_and_db):
|
||||
client, SessionLocal = client_and_db
|
||||
|
||||
Reference in New Issue
Block a user