docs(uiux): UIUX 设计方案大改 + 5 份作业指导书对齐 + 开发任务文档
- UIUX 文档:填充 19 个缺口(多主体画像/健康度/AI+看板/增长域/洞察域/创始人端/OODA/助推/商密) - UIUX 文档:插入 6 个新章节(十四~十九),旧章节重编号为二十~三十一,更新目录和交叉引用 - 作业指导书 x5:导航改为 6 域分组,新增 Context Bar/工作模式/Insight Rail/决策线程/多工作区等 UI 概念 - 新建 docs/2-task-uiux.md:50 个代码落地开发任务,按 P0-P6 分优先级 + 8 Sprint 规划 - 后端/前端:大量新增模型、路由、组件(来自之前 Phase 开发)
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
"""T2.12 驾驶舱增强测试 — 热力图 + 趋势对比接口。"""
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
|
||||
class TestDashboardHeatmap:
|
||||
"""热力图接口测试。"""
|
||||
|
||||
def test_heatmap_empty(self, client: TestClient, auth_headers: dict):
|
||||
"""无企业时应返回空列表。"""
|
||||
resp = client.get("/api/v1/dashboard/heatmap", headers=auth_headers)
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["code"] == 0
|
||||
assert isinstance(resp.json()["data"], list)
|
||||
|
||||
def test_heatmap_with_company(self, client: TestClient, auth_headers: dict, company_id: str):
|
||||
"""有企业时应返回热力图数据。"""
|
||||
resp = client.get("/api/v1/dashboard/heatmap", headers=auth_headers)
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()["data"]
|
||||
assert len(data) >= 1
|
||||
assert "company_id" in data[0]
|
||||
assert "company_name" in data[0]
|
||||
assert "scores" in data[0]
|
||||
|
||||
def test_heatmap_no_auth(self, client: TestClient):
|
||||
"""未认证应返回 401。"""
|
||||
resp = client.get("/api/v1/dashboard/heatmap")
|
||||
assert resp.status_code == 401
|
||||
|
||||
|
||||
class TestDashboardTrends:
|
||||
"""趋势对比接口测试。"""
|
||||
|
||||
def test_trends_empty(self, client: TestClient, auth_headers: dict):
|
||||
"""无评分数据时应返回空列表。"""
|
||||
resp = client.get("/api/v1/dashboard/trends", headers=auth_headers)
|
||||
assert resp.status_code == 200
|
||||
assert isinstance(resp.json()["data"], list)
|
||||
|
||||
def test_trends_with_months_param(self, client: TestClient, auth_headers: dict):
|
||||
"""指定 months 参数应正常返回。"""
|
||||
resp = client.get("/api/v1/dashboard/trends?months=3", headers=auth_headers)
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()["data"]
|
||||
assert isinstance(data, list)
|
||||
|
||||
def test_trends_with_company_id(self, client: TestClient, auth_headers: dict, company_id: str):
|
||||
"""指定企业 ID 应正常返回。"""
|
||||
resp = client.get(
|
||||
f"/api/v1/dashboard/trends?company_id={company_id}&months=6",
|
||||
headers=auth_headers,
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()["data"]
|
||||
assert isinstance(data, list)
|
||||
|
||||
def test_trends_invalid_months(self, client: TestClient, auth_headers: dict):
|
||||
"""无效 months 参数应返回 422。"""
|
||||
resp = client.get("/api/v1/dashboard/trends?months=0", headers=auth_headers)
|
||||
assert resp.status_code == 422
|
||||
|
||||
def test_trends_no_auth(self, client: TestClient):
|
||||
"""未认证应返回 401。"""
|
||||
resp = client.get("/api/v1/dashboard/trends")
|
||||
assert resp.status_code == 401
|
||||
Reference in New Issue
Block a user