docs: 为全部代码补充中文注释并加入 AGENTS 注释规范
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
"""工作流管理 API 测试。
|
||||
|
||||
覆盖工作流的创建、查询、校验、发布、版本列表与删除等管理接口。
|
||||
"""
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.main import app
|
||||
|
||||
|
||||
def definition() -> dict:
|
||||
"""构造一个引用 Echo 节点的合法工作流定义。"""
|
||||
return {
|
||||
"name": "echo-flow",
|
||||
"version": 1,
|
||||
@@ -21,6 +27,7 @@ def definition() -> dict:
|
||||
|
||||
|
||||
def test_workflow_crud_and_publish() -> None:
|
||||
"""验证工作流 CRUD、校验、发布与版本列表的完整流程。"""
|
||||
with TestClient(app) as client:
|
||||
created = client.post(
|
||||
"/api/admin/workflows",
|
||||
@@ -64,6 +71,7 @@ def test_workflow_crud_and_publish() -> None:
|
||||
|
||||
|
||||
def test_workflow_slug_without_id() -> None:
|
||||
"""验证未提供 ID 时后端会从名称生成 slug。"""
|
||||
with TestClient(app) as client:
|
||||
created = client.post(
|
||||
"/api/admin/workflows",
|
||||
@@ -77,6 +85,7 @@ def test_workflow_slug_without_id() -> None:
|
||||
|
||||
|
||||
def test_workflow_validation_error() -> None:
|
||||
"""验证重复节点 ID 的 DAG 会被拒绝。"""
|
||||
with TestClient(app) as client:
|
||||
response = client.post(
|
||||
"/api/admin/workflows",
|
||||
@@ -98,6 +107,7 @@ def test_workflow_validation_error() -> None:
|
||||
|
||||
|
||||
def test_publish_workflow_without_version() -> None:
|
||||
"""验证没有版本记录的工作流不能发布。"""
|
||||
with TestClient(app) as client:
|
||||
db = app.state.db
|
||||
db.upsert_workflow(
|
||||
|
||||
Reference in New Issue
Block a user