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,12 +1,22 @@
|
||||
meta {
|
||||
name: "Update Universal Progress"
|
||||
type: "http"
|
||||
name: Update Universal Progress
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: "{{baseUrl}}/api/progress/{{mediaItemId}}"
|
||||
body: {
|
||||
url: {{baseUrl}}/api/progress/{{mediaItemId}}
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{jwt}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"source": "web",
|
||||
"location": {
|
||||
"percentage": 0.45,
|
||||
@@ -18,16 +28,59 @@ post {
|
||||
"user_agent": "integration-test"
|
||||
}
|
||||
}
|
||||
headers: {
|
||||
Authorization: "Bearer {{jwt}}"
|
||||
Content-Type: "application/json"
|
||||
}
|
||||
}
|
||||
|
||||
tests {
|
||||
assertions {
|
||||
assert response.status == 200
|
||||
assert response.body.sync_status == "success"
|
||||
assert response.body.progress_updated == true
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
if (res.getStatus() === 200) {
|
||||
const body = res.getBody();
|
||||
tests['Sync status success'] = body.sync_status === "success";
|
||||
tests['Progress updated'] = body.progress_updated === true;
|
||||
}
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Update Universal Progress
|
||||
|
||||
Updates universal reading progress for a media item from a specific device or source.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/progress/{mediaItemId}
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `mediaItemId` (string): Media item UUID
|
||||
|
||||
**Request Body:**
|
||||
- `source` (string): Source identifier (web, kobo, koreader, device_id)
|
||||
- `location` (object): Progress location data
|
||||
- `percentage` (number): Progress percentage (0-1)
|
||||
- `page` (number, optional): Current page
|
||||
- `total_pages` (number, optional): Total pages
|
||||
- `epubcfi` (string, optional): EPUB location
|
||||
- `chapter` (number, optional): Current chapter
|
||||
- `device_metadata` (object): Device metadata
|
||||
- `device_type` (string): Device type
|
||||
- `user_agent` (string, optional): User agent string
|
||||
|
||||
**Response:**
|
||||
- `sync_status` (string): Sync status (success, partial)
|
||||
- `progress_updated` (boolean): Whether progress was updated
|
||||
- `conflicts_detected` (array, optional): Any conflicts detected
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 400: Invalid request data
|
||||
- 401: Unauthorized
|
||||
- 404: Media item not found
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user