新增征信解析接口与错误模拟

This commit is contained in:
wkc
2026-03-23 15:21:06 +08:00
parent 397bd07e1c
commit d7f34f009d
4 changed files with 165 additions and 1 deletions

View File

@@ -37,7 +37,21 @@ def reset_file_service_state():
@pytest.fixture
def client():
"""创建测试客户端"""
return TestClient(app)
original_routes = list(app.router.routes)
try:
from routers import credit_api
if not any(route.path == "/xfeature-mngs/conversation/htmlEval" for route in app.routes):
app.include_router(credit_api.router, tags=["征信解析接口"])
app.openapi_schema = None
except ModuleNotFoundError:
pass
try:
yield TestClient(app)
finally:
app.router.routes[:] = original_routes
app.openapi_schema = None
@pytest.fixture
@@ -68,3 +82,9 @@ def sample_inner_flow_request():
"dataEndDateId": 20240131,
"uploadUserId": 902001,
}
@pytest.fixture
def sample_credit_html_file():
"""示例征信 HTML 文件。"""
return ("credit.html", b"<html></html>", "text/html")