This commit is contained in:
2026-09-18 18:21:01 +08:00
parent e728dcd226
commit c51e6b793a
10 changed files with 71 additions and 53 deletions
+16
View File
@@ -158,6 +158,22 @@ async def test_json_media_type_from_extension(client, tmp_path):
assert "application/json" in resp.headers["content-type"]
# ── D3 收敛:单点聚合注册 ───────────────────────────────────────
def test_register_moldinsight_routers_mounts_api_and_html():
"""register_moldinsight_routers 一次挂载 /api 聚合路由 + 根路径 /html 报告代理
(入口侧不再重复 include_html_report)。"""
from moldinsight.api import register_moldinsight_routers
application = FastAPI()
register_moldinsight_routers(application)
paths = {route.path for route in application.routes}
assert "/api/upload" in paths
# Starlette route.path 保留 :path 转换器(OpenAPI 路径才显示 /html/{filename})
assert any(p.startswith("/html/{") for p in paths)
# ── 未命中与防护 ────────────────────────────────────────────────