refactor(bruno): migrate API tests to Bruno DSL format
- Convert all existing .bru files from JSON to Bruno DSL format - Remove obsolete files (conflicts/api.bru, kobo/Kobo Initialization.bru) - Update auth configuration to use 'inherit' instead of explicit bearer tokens - Add comprehensive documentation to all test files - Improve test scripts with proper assertions and error handling
This commit is contained in:
@@ -1,43 +1,93 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Bulk Resolve Conflicts",
|
||||
"type": "http",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"exec": [
|
||||
"// Test bulk resolution response",
|
||||
"if (response.status === 200) {",
|
||||
" tests['Bulk resolve successful'] = true;",
|
||||
" const body = JSON.parse(response.body);",
|
||||
" tests['Has results array'] = Array.isArray(body.results);",
|
||||
" tests['Has total count'] = body.total !== undefined;",
|
||||
" tests['Has success count'] = body.success !== undefined;",
|
||||
" tests['Has failed count'] = body.failed !== undefined;",
|
||||
" tests['Total equals sum of success and failed'] = body.total === body.success + body.failed;",
|
||||
"} else {",
|
||||
" tests['Bulk resolve failed'] = false;",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"req": {
|
||||
"url": "{{baseUrl}}/api/conflicts/bulk-resolve",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer {{authToken}}"
|
||||
},
|
||||
"body": {
|
||||
"conflict_ids": [
|
||||
"{{conflictId1}}",
|
||||
"{{conflictId2}}",
|
||||
"{{conflictId3}}"
|
||||
],
|
||||
"strategy": "most_recent"
|
||||
}
|
||||
meta {
|
||||
name: Bulk Resolve Conflicts
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/api/conflicts/bulk-resolve
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"conflict_ids": [
|
||||
"{{conflictId1}}",
|
||||
"{{conflictId2}}",
|
||||
"{{conflictId3}}"
|
||||
],
|
||||
"strategy": "most_recent"
|
||||
}
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
if (res.getStatus() === 200) {
|
||||
tests['Bulk resolve successful'] = true;
|
||||
const body = res.getBody();
|
||||
tests['Has results array'] = Array.isArray(body.results);
|
||||
tests['Has total count'] = body.total !== undefined;
|
||||
tests['Has success count'] = body.success !== undefined;
|
||||
tests['Has failed count'] = body.failed !== undefined;
|
||||
tests['Total equals sum of success and failed'] = body.total === body.success + body.failed;
|
||||
} else {
|
||||
tests['Bulk resolve failed'] = false;
|
||||
}
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Bulk Resolve Conflicts
|
||||
|
||||
Resolves multiple sync conflicts in a single request using a specified resolution strategy.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/conflicts/bulk-resolve
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Request Body:**
|
||||
- `conflict_ids` (array): Array of conflict UUIDs to resolve
|
||||
- `strategy` (string): Resolution strategy
|
||||
- `most_recent`: Use the most recently updated progress
|
||||
- `highest_progress`: Use the reading progress with the highest percent read
|
||||
- `server`: Always prefer server-side data
|
||||
- `device`: Always prefer device-side data
|
||||
|
||||
**Response:**
|
||||
- `results` (array): Results for each conflict resolution
|
||||
- `total` (number): Total number of conflicts processed
|
||||
- `success` (number): Number of successfully resolved conflicts
|
||||
- `failed` (number): Number of failed resolutions
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success (with partial results if some failed)
|
||||
- 400: Invalid request data
|
||||
- 401: Unauthorized
|
||||
- 403: Forbidden
|
||||
- 404: One or more conflicts not found
|
||||
- 500: Internal server error
|
||||
|
||||
**Example:**
|
||||
```json
|
||||
{
|
||||
"conflict_ids": ["uuid-1", "uuid-2", "uuid-3"],
|
||||
"strategy": "most_recent"
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** Conflicts are resolved atomically per conflict. If one resolution fails, others may still succeed.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user