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,15 +6,56 @@ meta {
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/api/sync/koreader/metadata/{{book_uuid}}
|
||||
headers: {
|
||||
Authorization: Bearer {{device_token}},
|
||||
Content-Type: application/json
|
||||
}
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
assert {
|
||||
res.status == 200
|
||||
res.body.uuid != null
|
||||
res.body.title != null
|
||||
res.body.progress != null
|
||||
headers {
|
||||
Authorization: Bearer {{device_token}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
if (res.getStatus() === 200) {
|
||||
const body = res.getBody();
|
||||
tests['Status is 200'] = true;
|
||||
tests['Has UUID'] = body.uuid !== null;
|
||||
tests['Has title'] = body.title !== null;
|
||||
tests['Has progress'] = body.progress !== null;
|
||||
}
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## KOReader Get Book Metadata
|
||||
|
||||
Retrieves metadata for a specific book from the KOReader sync endpoint.
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**Endpoint:** /api/sync/koreader/metadata/{book_uuid}
|
||||
|
||||
**Authentication:** Bearer token (device token)
|
||||
|
||||
**Path Parameters:**
|
||||
- `book_uuid` (string): Book UUID
|
||||
|
||||
**Response:**
|
||||
- `uuid` (string): Book UUID
|
||||
- `title` (string): Book title
|
||||
- `progress` (object): Reading progress data
|
||||
- `metadata` (object): Additional book metadata
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Book not found
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user