init
This commit is contained in:
48
tests/conftest.py
Normal file
48
tests/conftest.py
Normal file
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
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 请求 - 返回 form-data 格式的数据"""
|
||||
return {
|
||||
"projectNo": "test_project_001",
|
||||
"entityName": "测试企业",
|
||||
"userId": "902001",
|
||||
"userName": "902001",
|
||||
"appId": "remote_app",
|
||||
"appSecretCode": "test_secret_code_12345",
|
||||
"role": "VIEWER",
|
||||
"orgCode": "902000",
|
||||
"departmentCode": "902000",
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_inner_flow_request():
|
||||
"""示例拉取行内流水请求"""
|
||||
return {
|
||||
"groupId": 1001,
|
||||
"customerNo": "test_customer_001",
|
||||
"dataChannelCode": "test_code",
|
||||
"requestDateId": 20240101,
|
||||
"dataStartDateId": 20240101,
|
||||
"dataEndDateId": 20240131,
|
||||
"uploadUserId": 902001,
|
||||
}
|
||||
Reference in New Issue
Block a user