v0.2.0: CRM/ERP 系统升级 - 清理 .gitignore 并移除误提交的 venv/env/db 文件
- 更新 .gitignore:全面覆盖环境变量、数据库、日志、缓存、上传文件 - 移除误跟踪的 server/venv/、crm_data.db、.env 文件 - 新增 server/.env.example 模板 - 新增合同管理、利润核算、AI教练等功能模块 - 新增 Playwright e2e 测试套件 - 前后端多项功能升级和 bug 修复
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
利润核算模块测试 —— /api/profit
|
||||
"""
|
||||
import uuid
|
||||
import pytest
|
||||
from httpx import AsyncClient
|
||||
|
||||
|
||||
class TestProfitReport:
|
||||
"""GET /api/profit/report"""
|
||||
|
||||
async def test_profit_report(self, client: AsyncClient, admin_headers):
|
||||
"""利润报表(可能为空) → 200"""
|
||||
resp = await client.get("/api/profit/report", headers=admin_headers)
|
||||
assert resp.status_code == 200
|
||||
|
||||
async def test_profit_report_with_dates(self, client: AsyncClient, admin_headers):
|
||||
"""带日期范围 → 200"""
|
||||
resp = await client.get(
|
||||
"/api/profit/report?start_date=2026-01-01&end_date=2026-03-31",
|
||||
headers=admin_headers
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
|
||||
|
||||
class TestCostSnapshot:
|
||||
"""POST /api/profit/snapshot/{order_id}"""
|
||||
|
||||
async def test_snapshot_nonexistent_order(self, client: AsyncClient, admin_headers):
|
||||
"""不存在的订单快照 → 404 或空"""
|
||||
fake_id = uuid.uuid4()
|
||||
resp = await client.post(
|
||||
f"/api/profit/snapshot/{fake_id}",
|
||||
headers=admin_headers
|
||||
)
|
||||
# 可能返回 200 + 空结果,也可能 404
|
||||
assert resp.status_code in (200, 404, 500)
|
||||
Reference in New Issue
Block a user