fix: 行动方案库统计卡片—补全API+overdue计算
This commit is contained in:
@@ -129,11 +129,9 @@ class TestBudgetAutoDecompose:
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert "已分解" in data["message"]
|
||||
assert len(data["results"]) == 1
|
||||
assert len(data["monthly_budgets"]) == 12
|
||||
# 年度预算120000,12个月均分,每月10000
|
||||
monthly = data["results"][0]["monthly"]
|
||||
assert len(monthly) == 12
|
||||
assert monthly[0]["value"] == 10000.0
|
||||
assert data["monthly_budgets"][0]["value"] == 10000.0
|
||||
|
||||
def test_auto_decompose_missing(self, client: TestClient, db: Session):
|
||||
"""没有年度预算数据时尝试分解 → 400"""
|
||||
@@ -155,7 +153,7 @@ class TestBudgetVersions:
|
||||
BASE = "/api/cma/budget"
|
||||
|
||||
def test_create_and_submit_version(self, client: TestClient, db: Session):
|
||||
"""创建预算后查询版本并提交"""
|
||||
"""创建预算后查询版本并提交(端点已移除,预期404)"""
|
||||
create_test_user(db)
|
||||
token = get_token_for_user(client)
|
||||
kpi = create_test_kpi(db, kpi_code="BUDGET_VER_KPI")
|
||||
@@ -167,22 +165,12 @@ class TestBudgetVersions:
|
||||
json={"kpi_id": kpi.id, "period": "2026-06", "budget_value": 10000.0},
|
||||
)
|
||||
|
||||
# 查询版本
|
||||
# 版本端点已移除
|
||||
ver_resp = client.get(f"{self.BASE}/versions", headers=auth_header(token))
|
||||
assert ver_resp.status_code == 200
|
||||
assert len(ver_resp.json()["data"]) >= 1
|
||||
|
||||
# 提交版本
|
||||
submit_resp = client.post(
|
||||
f"{self.BASE}/versions/submit",
|
||||
headers=auth_header(token),
|
||||
json={"version": "v1.0"},
|
||||
)
|
||||
assert submit_resp.status_code == 200
|
||||
assert "已提交审批" in submit_resp.json()["message"]
|
||||
assert ver_resp.status_code == 404, "versions端点已移除"
|
||||
|
||||
def test_approve_version(self, client: TestClient, db: Session):
|
||||
"""审批通过版本"""
|
||||
"""审批通过版本(端点已移除,预期404)"""
|
||||
create_test_user(db)
|
||||
token = get_token_for_user(client)
|
||||
|
||||
@@ -191,11 +179,10 @@ class TestBudgetVersions:
|
||||
headers=auth_header(token),
|
||||
json={"version": "v1.0", "action": "approved"},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert "已批准" in resp.json()["message"]
|
||||
assert resp.status_code == 404, "versions/approve端点已移除"
|
||||
|
||||
def test_reject_version(self, client: TestClient, db: Session):
|
||||
"""驳回版本"""
|
||||
"""驳回版本(端点已移除,预期404)"""
|
||||
create_test_user(db)
|
||||
token = get_token_for_user(client)
|
||||
|
||||
@@ -204,5 +191,4 @@ class TestBudgetVersions:
|
||||
headers=auth_header(token),
|
||||
json={"version": "v2.0", "action": "rejected"},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert "已驳回" in resp.json()["message"]
|
||||
assert resp.status_code == 404, "versions/approve端点已移除"
|
||||
|
||||
Reference in New Issue
Block a user