- CLI + Web 双平台,基于 LLM 的 TDD+DDD 自动化测试生成 - 集成 unified-test-platform 903 个 D-Cloud 用例 + 13 个 Robogo 场景 - Agent 5 步流水线: 扫描 -> DDD -> LLM 生成测试 - 精确回归 + UI 变更检查 - 可视化 HTML 测试报告 - 暗色/亮色主题切换 - 19 个 API 端点 + 6 个 SPA 页面 - 15/15 项 TDD+DDD 合规
87 lines
3.1 KiB
Python
87 lines
3.1 KiB
Python
import pytest
|
||
from tests.utils import APIClient
|
||
|
||
|
||
@pytest.mark.api
|
||
@pytest.mark.monitor
|
||
class TestMonitorDashboardAPI:
|
||
"""监控仪表盘 API 接口测试"""
|
||
|
||
def test_get_user_info(self, api_client):
|
||
"""
|
||
描述:调用用户信息接口获取当前登录用户和组织信息
|
||
预期:接口返回 200,数据包含用户基本信息
|
||
"""
|
||
response = api_client.get("/api/dcloudUserApi/user/userAndOrg")
|
||
assert response.status_code == 200
|
||
|
||
def test_get_dataset_options(self, api_client):
|
||
"""
|
||
描述:调用数据集选项接口获取可用数据集列表
|
||
预期:接口返回 200,数据集选项列表可正常解析
|
||
"""
|
||
response = api_client.get("/api/embolabApi/v1/datasets/options")
|
||
assert response.status_code == 200
|
||
|
||
|
||
@pytest.mark.api
|
||
@pytest.mark.mirror_center
|
||
class TestMirrorCenterAPI:
|
||
"""镜像中心 API 接口测试"""
|
||
|
||
def test_get_categories(self, api_client):
|
||
"""
|
||
描述:调用镜像分类列表接口获取所有镜像分类
|
||
预期:接口返回 200,分类数据正常返回
|
||
"""
|
||
response = api_client.post("/api/imageCenterApi/v1/categories/list", json={})
|
||
assert response.status_code == 200
|
||
|
||
def test_get_mirror_list(self, api_client):
|
||
"""
|
||
描述:调用镜像列表接口获取第一页镜像数据(每页20条)
|
||
预期:接口返回 200,镜像列表数据正常返回
|
||
"""
|
||
response = api_client.post(
|
||
"/api/imageCenterApi/v2/images/list", json={"pageNum": 1, "pageSize": 20}
|
||
)
|
||
assert response.status_code == 200
|
||
|
||
def test_get_mirror_list_pagination(self, api_client):
|
||
"""
|
||
描述:调用镜像列表接口获取第二页镜像数据(每页10条)
|
||
预期:接口返回 200,分页数据正常返回
|
||
"""
|
||
response = api_client.post(
|
||
"/api/imageCenterApi/v2/images/list", json={"pageNum": 2, "pageSize": 10}
|
||
)
|
||
assert response.status_code == 200
|
||
|
||
def test_get_mirror_list_empty_params(self, api_client):
|
||
"""
|
||
描述:以空参数调用镜像列表接口验证接口健壮性
|
||
预期:接口返回 200 或 400(允许参数校验失败)
|
||
"""
|
||
response = api_client.post("/api/imageCenterApi/v2/images/list", json={})
|
||
assert response.status_code in [200, 400]
|
||
if response.status_code == 200:
|
||
result = response.json()
|
||
assert "status" in result
|
||
|
||
|
||
@pytest.mark.api
|
||
@pytest.mark.monitor
|
||
class TestMonitorDashboardContext:
|
||
"""监控仪表盘整体上下文 API 测试"""
|
||
|
||
def test_full_dashboard_context(self, api_client):
|
||
"""
|
||
描述:同时调用用户信息和数据集选项接口,验证完整仪表盘上下文数据可用性
|
||
预期:两个接口均返回 200,仪表盘所需数据完整
|
||
"""
|
||
user = api_client.get("/api/dcloudUserApi/user/userAndOrg")
|
||
assert user.status_code == 200
|
||
|
||
options = api_client.get("/api/embolabApi/v1/datasets/options")
|
||
assert options.status_code == 200
|