mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 04:46:26 +00:00
1. 重构后端API路由、CRUD与模块结构,整合日志管理,移除废弃demo代码 2. 优化前端组件类型定义、样式与路由配置,修复权限判断逻辑 3. 调整默认排序规则、滚动条样式与工具类函数,更新依赖与配置文件 4. 修复多处类型不匹配与默认值问题,完善表单与菜单验证逻辑
21 lines
483 B
Python
21 lines
483 B
Python
"""全局 pytest fixtures — test_client、test_db 等共享夹具。"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# 确保 backend 根目录在 Python 路径中
|
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
@pytest.fixture
|
|
def test_client() -> TestClient:
|
|
"""创建 TestClient 用于 API 测试。"""
|
|
from main import create_app
|
|
|
|
app = create_app()
|
|
with TestClient(app) as client:
|
|
yield client
|