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,21 +1,68 @@
|
||||
meta {
|
||||
name: "Get Progress History"
|
||||
type: "http"
|
||||
name: Get Progress History
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: "{{baseUrl}}/api/progress/{{mediaItemId}}/history"
|
||||
body: null
|
||||
headers: {
|
||||
Authorization: "Bearer {{jwt}}"
|
||||
Content-Type: "application/json"
|
||||
}
|
||||
url: {{baseUrl}}/api/progress/{{mediaItemId}}/history
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
tests {
|
||||
assertions {
|
||||
assert response.status == 200
|
||||
assert hasKey(response.body, "sessions")
|
||||
headers {
|
||||
Authorization: Bearer {{jwt}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
if (res.getStatus() === 200) {
|
||||
const body = res.getBody();
|
||||
tests['Has sessions key'] = body.sessions !== undefined;
|
||||
}
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Get Progress History
|
||||
|
||||
Retrieves historical reading progress sessions for a specific media item.
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**Endpoint:** /api/progress/{mediaItemId}/history
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `mediaItemId` (string): Media item UUID
|
||||
|
||||
**Query Parameters:**
|
||||
- `limit` (number, optional): Maximum number of sessions to return
|
||||
- `offset` (number, optional): Offset for pagination
|
||||
|
||||
**Response:**
|
||||
- `sessions` (array): Array of reading sessions
|
||||
- `session_id` (string): Session UUID
|
||||
- `start_time` (string): Session start timestamp
|
||||
- `end_time` (string): Session end timestamp
|
||||
- `start_percentage` (number): Progress at start
|
||||
- `end_percentage` (number): Progress at end
|
||||
- `device_id` (string): Device used
|
||||
- `duration_seconds` (number): Session duration
|
||||
- `total_sessions` (number): Total number of sessions
|
||||
- `total_reading_time` (number): Total reading time in seconds
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Media item not found
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
@@ -1,14 +1,55 @@
|
||||
meta {
|
||||
name: "Get Universal Progress"
|
||||
type: "http"
|
||||
name: Get Universal Progress
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: "{{baseUrl}}/api/progress/{{mediaItemId}}"
|
||||
body: null
|
||||
headers: {
|
||||
Authorization: "Bearer {{jwt}}"
|
||||
Content-Type: "application/json"
|
||||
}
|
||||
url: {{baseUrl}}/api/progress/{{mediaItemId}}
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{jwt}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Get Universal Progress
|
||||
|
||||
Retrieves universal reading progress for a specific media item across all devices.
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**Endpoint:** /api/progress/{mediaItemId}
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `mediaItemId` (string): Media item UUID
|
||||
|
||||
**Response:**
|
||||
- `media_item_id` (string): Media item UUID
|
||||
- `progress` (object): Universal progress data
|
||||
- `percentage` (number): Overall progress percentage
|
||||
- `epubcfi` (string): EPUB location
|
||||
- `page` (number): Current page
|
||||
- `chapter` (number): Current chapter
|
||||
- `devices` (array): Per-device progress data
|
||||
- `device_id` (string): Device UUID
|
||||
- `device_name` (string): Device name
|
||||
- `progress` (object): Device-specific progress
|
||||
- `last_updated` (string): Last update timestamp
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Media item not found
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
@@ -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