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/progress
|
||||
body: json({
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{device_token}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"library_id": null,
|
||||
"books": [
|
||||
{
|
||||
@@ -28,15 +38,61 @@ post {
|
||||
"koreader_version": "2024.01",
|
||||
"device_model": "kindle-paperwhite-5"
|
||||
}
|
||||
})
|
||||
headers: {
|
||||
Authorization: Bearer {{device_token}},
|
||||
Content-Type: application/json
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status == 202
|
||||
res.body.sync_status == "accepted"
|
||||
res.body.books_synced >= 0
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
if (res.getStatus() === 202) {
|
||||
const body = res.getBody();
|
||||
tests['Status is 202'] = res.getStatus() === 202;
|
||||
tests['Sync status accepted'] = body.sync_status === "accepted";
|
||||
tests('Books synced >= 0', body.books_synced >= 0);
|
||||
}
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## KOReader Sync Progress
|
||||
|
||||
Synchronizes reading progress from a KOReader device to the Bookhoard server.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/sync/koreader/progress
|
||||
|
||||
**Authentication:** Bearer token (device token)
|
||||
|
||||
**Request Body:**
|
||||
- `library_id` (string, optional): Library UUID
|
||||
- `books` (array): Array of book progress objects
|
||||
- `uuid` (string): Book UUID
|
||||
- `title` (string): Book title
|
||||
- `authors` (array): List of authors
|
||||
- `progress` (number): Progress value
|
||||
- `percentage` (number): Percentage complete (0-1)
|
||||
- `last_read` (string): ISO 8601 timestamp
|
||||
- `chapter` (number): Current chapter
|
||||
- `epubcfi` (string): EPUB Canonical Fragment Identifier
|
||||
- `page` (number): Current page
|
||||
- `total_pages` (number): Total pages
|
||||
- `sync_mode` (string): Sync mode (immediate, deferred)
|
||||
- `device_info` (object): Device information
|
||||
- `koreader_version` (string): KOReader version
|
||||
- `device_model` (string): Device model identifier
|
||||
|
||||
**Response:**
|
||||
- `sync_status` (string): Sync status (accepted, processing)
|
||||
- `books_synced` (number): Number of books synced
|
||||
|
||||
**Status Codes:**
|
||||
- 202: Accepted - sync queued
|
||||
- 401: Unauthorized
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user