refactor(test): 重构测试套件结构并优化测试配置
feat(test-suite): 新增测试套件模块,包含API测试客户端和测试配置 fix(api): 修复数据库实体和仓库的删除操作返回值 style(api): 统一数据库表名和字段命名 perf(api): 添加缓存注解提升配置查询性能 test(api): 添加H2测试数据库配置支持 chore: 清理旧的测试文件和脚本
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# API 集成测试 - 登录测试
|
||||
import pytest
|
||||
import sys
|
||||
import os
|
||||
|
||||
# 添加当前目录到Python路径
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from api.base_api import BaseAPIClient
|
||||
|
||||
|
||||
class TestLoginAPI:
|
||||
"""登录 API 测试"""
|
||||
|
||||
def test_login_success(self):
|
||||
"""测试登录成功"""
|
||||
client = BaseAPIClient(base_url='http://localhost:8084')
|
||||
result = client.login('admin', 'admin123')
|
||||
assert result, "登录应该成功"
|
||||
assert client.token is not None, "Token 应该被设置"
|
||||
Reference in New Issue
Block a user