mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 12:52:26 +00:00
最新代码
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class APICaseCreateSchema(BaseModel):
|
||||
"""接口测试用例创建模型"""
|
||||
name: str = Field(..., max_length=50, description='测试用例名称')
|
||||
url: str = Field(..., max_length=255, description="接口地址")
|
||||
method: str = Field(..., max_length=10, description="请求方法")
|
||||
headers: Optional[str] = Field(None, description="请求头")
|
||||
data_type: Optional[str] = Field(None, description="请求参数类型(params/data/json/file)")
|
||||
data: Optional[str] = Field(None, description="请求体")
|
||||
|
||||
expected_status_code: int = Field(..., gt=0, description="预期状态码")
|
||||
expected_msg: Optional[str] = Field(None, description="预期消息")
|
||||
expected_response: Optional[str] = Field(None, description="预期响应")
|
||||
assertions_status_code: Optional[str] = Field(None, description="状态码断言规则(=, !=, >, <, >=, <=, in, not in)")
|
||||
assertions_msg: Optional[str] = Field(None, description="消息断言规则(=, !=, >, <, >=, <=, in, not in)")
|
||||
assertions_response: Optional[str] = Field(None, description="响应断言规则(=, !=, >, <, >=, <=, in, not in)")
|
||||
|
||||
description: Optional[str] = Field(None, max_length=255, description="测试用例描述")
|
||||
environment_id: int = Field(..., gt=0, description="所属环境ID")
|
||||
global_data_id: Optional[int] = Field(None, gt=0, description="关联全局数据ID")
|
||||
module_id: int = Field(..., gt=0, description="所属模块ID")
|
||||
project_id: int = Field(..., gt=0, description="所属项目ID")
|
||||
|
||||
|
||||
class APICaseUpdateSchema(APICaseCreateSchema):
|
||||
"""接口测试用例更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口测试用例ID")
|
||||
|
||||
|
||||
class APICaseOutSchema(APICaseCreateSchema, BaseSchema):
|
||||
"""接口测试用例响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class CaseCreateSchema(BaseModel):
|
||||
"""接口测试用例创建模型"""
|
||||
name: str = Field(..., description='测试用例名称')
|
||||
status: Optional[bool] = Field(True, description='是否启用')
|
||||
url: str = Field(..., description="接口地址")
|
||||
method: str = Field(..., description="请求方法")
|
||||
headers: Optional[dict] = Field(None, description="请求头")
|
||||
params: Optional[dict] = Field(None, description="Query参数")
|
||||
body: Optional[dict] = Field(None, description="请求体")
|
||||
files: Optional[dict] = Field(None, description="上传文件配置")
|
||||
parameter_need: bool = Field(True, description="是否需要公共参数")
|
||||
expected: Optional[list] = Field(None, description="断言配置")
|
||||
project_id: int = Field(..., gt=0, description="所属项目ID")
|
||||
|
||||
description: Optional[str] = Field(None, description="备注说明")
|
||||
|
||||
|
||||
class CaseUpdateSchema(CaseCreateSchema):
|
||||
"""接口测试用例更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口测试用例ID")
|
||||
|
||||
|
||||
class CaseOutSchema(CaseCreateSchema, BaseSchema):
|
||||
"""接口测试用例响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
project: Optional[dict] = Field(None, description="所属项目信息")
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class EnvironmentCreateSchema(BaseModel):
|
||||
"""环境模型"""
|
||||
name: str = Field(..., max_length=50, description='环境名称')
|
||||
base_url: str = Field(..., max_length=255, description="基础URL")
|
||||
project_id: int = Field(..., gt=0, description="所属项目ID")
|
||||
description: Optional[str] = Field(None, max_length=255, description="环境描述")
|
||||
|
||||
|
||||
class EnvironmentUpdateSchema(EnvironmentCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
class EnvironmentOutSchema(EnvironmentCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -1,25 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class GlobalDataCreateSchema(BaseModel):
|
||||
"""全局参数模型"""
|
||||
name: str = Field(..., max_length=40, description="参数名称")
|
||||
value: str = Field(..., description="参数值")
|
||||
project_id: int = Field(..., gt=0, description="所属项目ID")
|
||||
description: Optional[str] = Field(None, max_length=255, description="局参数描述")
|
||||
|
||||
|
||||
class GlobalDataUpdateSchema(GlobalDataCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
class GlobalDataOutSchema(GlobalDataCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -1,24 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class ModuleCreateSchema(BaseModel):
|
||||
"""模块模型"""
|
||||
name: str = Field(..., max_length=40, description="模块名称")
|
||||
project_id: int = Field(..., gt=0, description="所属项目ID")
|
||||
description: Optional[str] = Field(None, max_length=255, description="模块描述")
|
||||
|
||||
|
||||
class ModuleUpdateSchema(ModuleCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
class ModuleOutSchema(ModuleCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -1,25 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class NotificationConfigCreateSchema(BaseModel):
|
||||
"""通知配置模型"""
|
||||
name: str = Field(..., max_length=40, description="通知类型(邮件、钉钉、Slack等)")
|
||||
config: dict = Field(..., description="通知配置")
|
||||
project_id: int = Field(..., gt=0, description="所属项目ID")
|
||||
description: Optional[str] = Field(None, max_length=255, description="通知配置描述")
|
||||
|
||||
|
||||
class NotificationConfigUpdateSchema(NotificationConfigCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
class NotificationConfigOutSchema(NotificationConfigCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -8,9 +8,12 @@ from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class ProjectCreateSchema(BaseModel):
|
||||
"""项目模型"""
|
||||
name: str = Field(..., max_length=40, description="项目名称")
|
||||
description: Optional[str] = Field(None, max_length=255, description="通知配置描述")
|
||||
"""项目创建模型"""
|
||||
name: str = Field(..., description="项目名称")
|
||||
base_url: str = Field(..., description="基础URL")
|
||||
headers: Optional[dict] = Field(None, description="公共请求头")
|
||||
message: Optional[dict] = Field(None, description="通知配置")
|
||||
description: Optional[str] = Field(None, description="备注说明")
|
||||
|
||||
|
||||
class ProjectUpdateSchema(ProjectCreateSchema):
|
||||
@@ -19,6 +22,8 @@ class ProjectUpdateSchema(ProjectCreateSchema):
|
||||
|
||||
|
||||
class ProjectOutSchema(ProjectCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
"""项目响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
cases: Optional[list] = Field(None, description="关联的用例")
|
||||
tasks: Optional[list] = Field(None, description="关联的任务")
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class ReportCreateSchema(BaseModel):
|
||||
"""测试报告模型"""
|
||||
name: str = Field(..., max_length=40, description="测试报告名称")
|
||||
task_id: int = Field(..., gt=0, description="关联的任务ID")
|
||||
summary: dict = Field(..., description="报告摘要")
|
||||
details: dict = Field(..., description="详细报告")
|
||||
description: Optional[str] = Field(None, max_length=255, description="通知配置描述")
|
||||
|
||||
|
||||
class ReportUpdateSchema(ReportCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
class ReportOutSchema(ReportCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -1,24 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.core.base_schema import BaseSchema
|
||||
|
||||
|
||||
class SuiteCreateSchema(BaseModel):
|
||||
"""套件模型"""
|
||||
name: str = Field(..., max_length=40, description="套件名称")
|
||||
project_id: int = Field(..., gt=0, description="所属项目ID")
|
||||
description: Optional[str] = Field(None, max_length=255, description="通知配置描述")
|
||||
|
||||
|
||||
class SuiteUpdateSchema(SuiteCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
class SuiteOutSchema(SuiteCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -9,18 +9,32 @@ from app.core.base_schema import BaseSchema
|
||||
|
||||
class TaskCreateSchema(BaseModel):
|
||||
"""执行记录模型"""
|
||||
test_case_id: int = Field(..., gt=0, description="关联的测试用例ID")
|
||||
status: str = Field(..., max_length=10, description="执行状态")
|
||||
logs: Optional[list] = Field(None, description="执行日志")
|
||||
actual_response: Optional[dict] = Field(None, description="实际响应(仅API测试)")
|
||||
name: str = Field(..., max_length=40, description="任务名称")
|
||||
project_id: int = Field(..., gt=0, description="所属项目ID")
|
||||
description: Optional[str] = Field(None, max_length=255, description="环境描述")
|
||||
|
||||
status: Optional[str] = Field(..., default="pedding", max_length=10, description="执行状态")
|
||||
|
||||
start_time: Optional[str] = Field(None, description="开始时间")
|
||||
end_time: Optional[str] = Field(None, description="结束时间")
|
||||
summary: Optional[dict] = Field(None, description="报告摘要")
|
||||
|
||||
total_count: Optional[int] = Field(None, ge=0, description="用例总数")
|
||||
success_count: Optional[int] = Field(None, ge=0, description="成功数")
|
||||
fail_count: Optional[int] = Field(None, ge=0, description="失败数")
|
||||
skip_count: Optional[int] = Field(None, ge=0, description="跳过数")
|
||||
error_count: Optional[int] = Field(None, ge=0, description="错误数")
|
||||
|
||||
logs: Optional[list] = Field(None, description="执行日志")
|
||||
actual_response: Optional[dict] = Field(None, description="实际响应(仅API测试)")
|
||||
|
||||
class TaskUpdateSchema(TaskCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
|
||||
class TaskOutSchema(TaskCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
project: Optional[dict] = Field(None, description="所属项目信息")
|
||||
Reference in New Issue
Block a user