task-202: Python-contract 夹具准备(heartbeat/items/result/parsed_payload schema-fixture,字段取自真实 DTO、全脱敏、README 说明)+ 9 条测试

This commit is contained in:
2026-09-05 02:10:16 +08:00
parent d3b499b596
commit 5c0f535aca
7 changed files with 226 additions and 0 deletions
@@ -0,0 +1,19 @@
# Python-contract 夹具(task-202
> 目录:`src/test/resources/python-contract/`。用途:模块 13 的 /result、/items、parsed-payload、heartbeat 契约测试固定输入。
## 内容与字段来源
| 文件 | 对应 Worker 接口 | 字段来源(服务 DTO,非臆造) |
|---|---|---|
| heartbeat.request.json | POST /api/tasks/{taskId}/heartbeat | `TaskHeartbeatRequest`moduleType/phase/current/total/collectStage/currentKeyword/search*Page*/detail*Asins |
| heartbeat.response.json | 同上响应 | `TaskHeartbeatVo`alive/status/moduleType/message |
| items.response.json | GET /tasks/{taskId}/itemscollectdata | `CollectDataItemsPageVo`+`CollectDataItemVo`(分页字段 + items 行结构) |
| result.request.json | 模块 submit-resultsimilarasin 示例) | `SimilarAsinSubmitResultRequest`submissionId/chunkIndex/chunkTotal/done/error/groups |
| parsed_payload.response.json | GET /tasks/{taskId}/parsed-payloadsimilarasin | `SimilarAsinParsedPayloadDto`aiPrompt/apiKey/imgSwitch/…/items/allItems/groups |
## 说明
- **脱敏**:所有值均为伪造(taskId/ASIN/文件名/关键词等);敏感字段已置占位——`parsed_payload.response.json``apiKey="<redacted>"``aiPrompt="<redacted-prompt>"`,不含任何真实凭据。
- **来源口径**schema-fixture(字段取自本服务 DTO);非录自 app_client/amazon 真实抓包。若后续在具备桌面端/爬虫运行环境时录制真实报文,可另存 `*.recorded.json` 增补,不替换本 schema-fixture。
- **可复现**:纯静态 JSON,可重复用于契约测试。
@@ -0,0 +1,12 @@
{
"moduleType": "similarasin",
"phase": "search",
"current": 3,
"total": 10,
"collectStage": "keyword-search",
"currentKeyword": "ring",
"searchCurrentPage": 1,
"searchTotalPages": 4,
"detailProcessedAsins": 12,
"detailTotalAsins": 120
}
@@ -0,0 +1,6 @@
{
"alive": true,
"status": "RUNNING",
"moduleType": "similarasin",
"message": "ok"
}
@@ -0,0 +1,25 @@
{
"taskId": 7004,
"taskNo": "SA-20260905-7004",
"taskType": "collect-data",
"taskStatus": "RUNNING",
"page": 1,
"pageSize": 50,
"count": 1,
"total": 1,
"totalPages": 1,
"filters": {
"country": "US"
},
"items": [
{
"id": 1,
"rowIndex": 1,
"sourceFileKey": "in/example.xlsx",
"sourceFilename": "example.xlsx",
"keyword": "ring",
"statusValue": "PENDING",
"extra": {}
}
]
}
@@ -0,0 +1,29 @@
{
"aiPrompt": "<redacted-prompt>",
"apiKey": "<redacted>",
"imgSwitch": false,
"categorySwitch": false,
"sourceFiles": [],
"headers": [
"asin",
"keyword",
"title"
],
"items": [
{
"rowIndex": 1,
"asin": "B0FAKETEST123",
"keyword": "ring",
"title": "example"
}
],
"allItems": [
{
"rowIndex": 1,
"asin": "B0FAKETEST123",
"keyword": "ring",
"title": "example"
}
],
"groups": []
}
@@ -0,0 +1,20 @@
{
"submissionId": "sim-20260905-0001",
"chunkIndex": 0,
"chunkTotal": 1,
"done": true,
"error": null,
"groups": [
{
"name": "group-1",
"items": [
{
"rowIndex": 1,
"keyword": "ring",
"asin": "B0FAKETEST123",
"status": "SUCCESS"
}
]
}
]
}