新增完善测试模板

This commit is contained in:
2026-05-03 17:52:52 +08:00
parent 07fa0b0038
commit dd6236866e
26 changed files with 1319 additions and 5 deletions

17
tests/fixtures/README.md vendored Normal file
View File

@@ -0,0 +1,17 @@
# fixtures脱敏样例
本目录存放 **golden case / contract test** 用的输入、期望输出与 **adapter profile 样例**
## 规则
- 只能放**虚构、脱敏、可公开**的数据(演示租户、演示 request_id 等)。
- **禁止**:真实客户名、真实订单/提单号、真实报关单、真实 token/cookie、真实内网 URL、生产环境凭证。
- `adapter_profiles.sample.yaml` 中的 URL 须使用 `localhost``example.invalid` 等明显占位;`credential_ref` 仅表达「从密钥库引用」的约定,**不得**内嵌密钥。
## 与本仓库测试的对应关系
| 文件 | 用途 |
|------|------|
| `sample_request.json` | 通用请求体样例,供 ``tests/samples/test_golden_cases.py.sample`` 演示读取。 |
| `expected_response.json` | 与上配套的期望摘要字段(业务复制后按域替换)。 |
| `adapter_profiles.sample.yaml` | 五类运行方式mock / simulator_api / simulator_rpa / real_api / real_rpa的配置表达样例。 |

View File

@@ -0,0 +1,40 @@
# 样例:五类 adapter 运行方式(复制到业务仓后按环境改名;勿提交真实凭证)
runtime:
profile: mock
adapters:
demo_external_system:
interface: demo
profile: mock
mock:
target: mock
channel: none
simulator_api:
target: simulator
channel: api
base_url: http://localhost:5180/api/demo
timeout_seconds: 10
simulator_rpa:
target: simulator
channel: rpa
entry_url: http://localhost:5180/select
timeout_seconds: 30
real_api:
target: real
channel: api
base_url: https://example.invalid/api
credential_ref: vault://tenant/demo/external-system/api
write_enabled: false
timeout_seconds: 20
real_rpa:
target: real
channel: rpa
entry_url: https://example.invalid/portal
credential_ref: vault://tenant/demo/external-system/rpa
write_enabled: false
timeout_seconds: 60

6
tests/fixtures/expected_response.json vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"success": true,
"data": {
"status": "ok"
}
}

11
tests/fixtures/sample_request.json vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"request_id": "req_test_001",
"tenant_id": "tenant_demo",
"actor": "tester",
"parameters": {
"input_text": "demo input",
"options": {
"dry_run": true
}
}
}