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:
2026-02-08 20:49:06 -05:00
parent cb76b9ca05
commit 3117ce54ec
93 changed files with 3974 additions and 1576 deletions
@@ -1,35 +1,71 @@
{
"meta": {
"name": "Download Book KEPUB (On-the-fly Conversion)",
"type": "http",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Test format-specific hash header",
"const kepubHash = resp.headers.get('X-Bookhoard-KEPUB-SHA256');",
"if (kepubHash) {",
" tests['KEPUB hash present'] = true;",
" tests['Hash is 64 chars'] = kepubHash.length === 64;",
"} else {",
" tests['KEPUB hash present'] = false;",
"}",
"",
"// Verify Bookhoard UUID header",
"const bookhoardUUID = resp.headers.get('X-Bookhoard-UUID');",
"tests['Bookhoard UUID present'] = bookhoardUUID !== null;",
"",
"// Verify content type",
"const contentType = resp.headers.get('Content-Type');",
"tests['Content-Type is KEPUB'] = contentType && contentType.includes('kepub');"
]
}
}
]
},
"req": {
"url": "{{baseUrl}}/opds/devices/{{deviceId}}/download/{{mediaItemId}}?format=kepub",
"method": "GET"
meta {
name: Download Book KEPUB (On-the-fly Conversion)
type: http
seq: 1
}
get {
url: {{baseUrl}}/opds/devices/{{deviceId}}/download/{{mediaItemId}}?format=kepub
body: none
auth: inherit
}
script:post-response {
function onResponse(res) {
const headers = res.getHeaders();
const kepubHash = headers.get('X-Bookhoard-KEPUB-SHA256');
if (kepubHash) {
tests['KEPUB hash present'] = true;
tests['Hash is 64 chars'] = kepubHash.length === 64;
} else {
tests['KEPUB hash present'] = false;
}
const bookhoardUUID = headers.get('X-Bookhoard-UUID');
tests['Bookhoard UUID present'] = bookhoardUUID !== null;
const contentType = headers.get('Content-Type');
tests['Content-Type is KEPUB'] = contentType && contentType.includes('kepub');
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Download Book KEPUB (On-the-fly Conversion)
Downloads a book in Kobo EPUB (KEPUB) format with on-the-fly conversion if needed.
**Method:** GET
**Endpoint:** /opds/devices/{deviceId}/download/{mediaItemId}?format=kepub
**Authentication:** Bearer token
**Path Parameters:**
- `deviceId` (string): Device UUID
- `mediaItemId` (string): Media item UUID
**Query Parameters:**
- `format` (string): Must be "kepub"
**Response Headers:**
- `X-Bookhoard-KEPUB-SHA256` (string): SHA-256 hash of the KEPUB file (64 chars)
- `X-Bookhoard-UUID` (string): Bookhoard UUID for the media item
- `Content-Type` (string): Will be "application/kepub+json" or similar
**Response Body:** Binary KEPUB file data
**Status Codes:**
- 200: Success - KEPUB file returned
- 401: Unauthorized
- 404: Media item or device not found
- 500: Internal server error or conversion failure
**Note:** The KEPUB format adds special Kobo-specific markup to enhance reading features on Kobo devices. The file is converted on-the-fly if the source is not already KEPUB.
}