Files
novalon-manage-system/api_integration_tests/api/config_api.py
T
张翔 c50ccd258f feat: 重构测试框架并优化代码结构
refactor(tests): 将e2e_tests迁移到tests_suite和api_integration_tests
style: 为Java类添加文档注释
docs: 更新.gitignore和配置文件
test: 添加性能测试和Playwright测试脚本
chore: 清理旧测试文件和配置
2026-03-14 13:49:39 +08:00

39 lines
1.1 KiB
Python

"""
系统配置API封装
"""
from typing import Dict, Any
from httpx import AsyncClient
class SysConfigAPI:
"""系统参数配置API"""
def __init__(self, client: AsyncClient):
self.client = client
self.base_path = "/api/config"
async def get_all(self) -> Any:
"""获取所有配置"""
return await self.client.get(self.base_path)
async def get_by_key(self, config_key: str) -> Any:
"""根据key获取配置"""
return await self.client.get(f"{self.base_path}/key/{config_key}")
async def create(self, data: Dict[str, Any]) -> Any:
"""创建配置"""
return await self.client.post(self.base_path, json=data)
async def update(self, config_id: int, data: Dict[str, Any]) -> Any:
"""更新配置"""
return await self.client.put(f"{self.base_path}/{config_id}", json=data)
async def delete(self, config_id: int) -> Any:
"""删除配置"""
return await self.client.delete(f"{self.base_path}/{config_id}")
async def refresh_cache(self) -> Any:
"""刷新缓存"""
return await self.client.post(f"{self.base_path}/refresh")