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:
@@ -6,7 +6,17 @@ meta {
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/api/sync/koreader/bookmarks
|
||||
body: json({
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{device_token}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"book_uuid": "{{book_uuid}}",
|
||||
"bookmarks": [
|
||||
{
|
||||
@@ -46,15 +56,57 @@ post {
|
||||
"percentage": 0.45
|
||||
}
|
||||
]
|
||||
})
|
||||
headers: {
|
||||
Authorization: Bearer {{device_token}},
|
||||
Content-Type: application/json
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status == 200
|
||||
res.body.sync_status == "completed"
|
||||
res.body.total_synced >= 0
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
if (res.getStatus() === 200) {
|
||||
const body = res.getBody();
|
||||
tests['Sync completed'] = body.sync_status === "completed";
|
||||
tests('Items synced >= 0', body.total_synced >= 0);
|
||||
}
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## KOReader Sync Bookmarks
|
||||
|
||||
Synchronizes bookmarks, notes, and highlights from a KOReader device.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/sync/koreader/bookmarks
|
||||
|
||||
**Authentication:** Bearer token (device token)
|
||||
|
||||
**Request Body:**
|
||||
- `book_uuid` (string): Book UUID
|
||||
- `bookmarks` (array): Array of bookmark objects
|
||||
- `notes` (array): Array of note objects
|
||||
- `highlights` (array): Array of highlight objects
|
||||
|
||||
Each object includes:
|
||||
- `chapter` (number): Chapter number
|
||||
- `datetime` (string): ISO 8601 timestamp
|
||||
- `text` (string): Highlighted/bookmarked text
|
||||
- `pos0`, `pos1` (string): EPUB CFI positions
|
||||
- `page` (number): Page number
|
||||
- `type` (string): Type (highlight, bookmark, note)
|
||||
- `percentage` (number): Position in book (0-1)
|
||||
|
||||
**Response:**
|
||||
- `sync_status` (string): Sync status (completed, partial)
|
||||
- `total_synced` (number): Number of items synced
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user