mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 12:52:26 +00:00
update: redis配置适配密码格式
create:加入自动化测试管理模块
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# -*- 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,25 @@
|
||||
# -*- 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)
|
||||
@@ -0,0 +1,25 @@
|
||||
# -*- 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)
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- 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)
|
||||
@@ -0,0 +1,25 @@
|
||||
# -*- 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)
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
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="通知配置描述")
|
||||
|
||||
|
||||
class ProjectUpdateSchema(ProjectCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
class ProjectOutSchema(ProjectCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# -*- 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)
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- 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)
|
||||
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
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测试)")
|
||||
description: Optional[str] = Field(None, max_length=255, description="环境描述")
|
||||
|
||||
|
||||
class TaskUpdateSchema(TaskCreateSchema):
|
||||
"""接口更新模型"""
|
||||
id: int = Field(..., gt=0, description="接口ID")
|
||||
|
||||
|
||||
class TaskOutSchema(TaskCreateSchema, BaseSchema):
|
||||
"""接口响应模型"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
Reference in New Issue
Block a user