test: add comprehensive test suite

This commit is contained in:
wkc
2026-03-03 09:29:14 +08:00
parent 661fa88839
commit 651e4540af
3 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
"""
Pytest 配置和共享 fixtures
"""
import pytest
from fastapi.testclient import TestClient
import sys
import os
# 添加项目根目录到 sys.path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from main import app
@pytest.fixture
def client():
"""创建测试客户端"""
return TestClient(app)
@pytest.fixture
def sample_token_request():
"""示例 Token 请求"""
return {
"projectNo": "test_project_001",
"entityName": "测试企业",
"userId": "902001",
"userName": "902001",
"orgCode": "902000",
}