Files
FastapiAdmin/backend/tests/test_api_module_common.py
T
zhangtao 5ff72b086f refactor: 重构项目模块结构与代码细节优化
1.  调整后端模块路由与插件文件结构,迁移部分模块代码至api/v1目录
2.  优化代码注释格式与文档字符串,简化冗余代码
3.  添加监控仪表盘、工单评论等新模块功能
4.  修复前端部分组件交互逻辑与类型定义
5.  清理冗余的初始化数据与废弃配置文件
6.  新增租户注册表单字段与国际化支持
7.  优化HTTP请求拦截器与快捷键功能
2026-07-10 00:18:11 +08:00

35 lines
1.1 KiB
Python

"""模块接口测试 —— module_common(公共模块)
每个接口一个测试用例,验证路由存在且返回码正确。
"""
from conftest import assert_route
from fastapi.testclient import TestClient
class TestHealth:
"""健康检查接口。"""
def test_health_check(self, test_client: TestClient) -> None:
assert_route(test_client, "GET", "/common/health", expected_status=200)
def test_health_ready(self, test_client: TestClient) -> None:
assert_route(test_client, "GET", "/common/health/ready", expected_status=200)
def test_health_live(self, test_client: TestClient) -> None:
assert_route(test_client, "GET", "/common/health/live", expected_status=200)
class TestFile:
"""文件管理接口。"""
def test_upload_file(self, test_client: TestClient) -> None:
assert_route(test_client, "POST", "/common/file/upload")
def test_download_file(self, test_client: TestClient) -> None:
assert_route(
test_client,
"POST",
"/common/file/download",
json={"file_path": "test.txt", "delete": False},
)