refactor(test): 重构测试套件结构并优化测试配置
feat(test-suite): 新增测试套件模块,包含API测试客户端和测试配置 fix(api): 修复数据库实体和仓库的删除操作返回值 style(api): 统一数据库表名和字段命名 perf(api): 添加缓存注解提升配置查询性能 test(api): 添加H2测试数据库配置支持 chore: 清理旧的测试文件和脚本
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
认证 API 客户端
|
||||
"""
|
||||
|
||||
from httpx import AsyncClient
|
||||
|
||||
|
||||
class AuthAPI:
|
||||
"""认证 API 客户端"""
|
||||
|
||||
def __init__(self, client: AsyncClient):
|
||||
self.client = client
|
||||
|
||||
async def login(self, username: str, password: str):
|
||||
"""登录"""
|
||||
return await self.client.post('/api/auth/login', json={
|
||||
'username': username,
|
||||
'password': password
|
||||
})
|
||||
|
||||
async def register(self, username: str, password: str, email: str):
|
||||
"""注册"""
|
||||
return await self.client.post('/api/auth/register', json={
|
||||
'username': username,
|
||||
'password': password,
|
||||
'email': email
|
||||
})
|
||||
|
||||
async def logout(self):
|
||||
"""登出"""
|
||||
return await self.client.post('/api/auth/logout')
|
||||
Reference in New Issue
Block a user