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,19 +1,61 @@
|
||||
meta {
|
||||
name: "Download Device Sidecar File"
|
||||
name: Download Device Sidecar File
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{base_url}}/api/devices/{{device_id}}/sidecar/download
|
||||
auth: {
|
||||
type: bearer
|
||||
bearer: {{user_token}}
|
||||
}
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
assert {
|
||||
response.status == 200
|
||||
response.headers["Content-Type"] contains "application/json"
|
||||
response.headers["Content-Disposition"] contains ".bookhoard.json"
|
||||
headers {
|
||||
Authorization: Bearer {{user_token}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
if (res.getStatus() === 200) {
|
||||
const headers = res.getHeaders();
|
||||
const contentType = headers.get("Content-Type");
|
||||
const contentDisposition = headers.get("Content-Disposition");
|
||||
tests('Content-Type is JSON', contentType && contentType.includes("application/json"));
|
||||
tests('Has .bookhoard.json filename', contentDisposition && contentDisposition.includes(".bookhoard.json"));
|
||||
}
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Download Device Sidecar File
|
||||
|
||||
Downloads the sidecar configuration file for a device in JSON format.
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**Endpoint:** /api/devices/{device_id}/sidecar/download
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `device_id` (string): Device UUID
|
||||
|
||||
**Response Headers:**
|
||||
- `Content-Type`: application/json
|
||||
- `Content-Disposition`: attachment; filename="device.bookhoard.json"
|
||||
|
||||
**Response Body:** JSON sidecar configuration file
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success - file returned
|
||||
- 401: Unauthorized
|
||||
- 404: Device not found
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user