mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-20 20:39:55 +00:00
1. 调整后端模块路由与插件文件结构,迁移部分模块代码至api/v1目录 2. 优化代码注释格式与文档字符串,简化冗余代码 3. 添加监控仪表盘、工单评论等新模块功能 4. 修复前端部分组件交互逻辑与类型定义 5. 清理冗余的初始化数据与废弃配置文件 6. 新增租户注册表单字段与国际化支持 7. 优化HTTP请求拦截器与快捷键功能
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
"""模块接口测试 —— module_ai(AI 对话模块)
|
|
|
|
动态路由映射:module_ai → /ai
|
|
每个接口一个测试用例,覆盖会话 CRUD 与 AI 对话。
|
|
"""
|
|
|
|
from conftest import assert_route
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
class TestAiChat:
|
|
"""AI 对话接口。"""
|
|
|
|
def test_ai_chat_list(self, test_client: TestClient) -> None:
|
|
assert_route(test_client, "GET", "/ai/chat/list")
|
|
|
|
def test_ai_chat_detail(self, test_client: TestClient) -> None:
|
|
assert_route(test_client, "GET", "/ai/chat/detail/test_session")
|
|
|
|
def test_ai_chat_create(self, test_client: TestClient) -> None:
|
|
assert_route(
|
|
test_client,
|
|
"POST",
|
|
"/ai/chat/create",
|
|
json={"title": "测试会话"},
|
|
)
|
|
|
|
def test_ai_chat_update(self, test_client: TestClient) -> None:
|
|
assert_route(
|
|
test_client,
|
|
"PUT",
|
|
"/ai/chat/update/test_session",
|
|
json={"title": "更新会话"},
|
|
)
|
|
|
|
def test_ai_chat_delete(self, test_client: TestClient) -> None:
|
|
assert_route(test_client, "DELETE", "/ai/chat/delete", json=["test_session"])
|
|
|
|
def test_ai_chat_non_stream(self, test_client: TestClient) -> None:
|
|
assert_route(
|
|
test_client,
|
|
"POST",
|
|
"/ai/chat/ai-chat",
|
|
json={"message": "你好", "session_id": "test_session"},
|
|
)
|