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,23 +1,67 @@
|
||||
meta {
|
||||
name: "Update System Configuration"
|
||||
name: Update System Configuration
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{base_url}}/api/system/config
|
||||
body: json({
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"base_url": "https://bookhoard.example.com",
|
||||
"opds_base_url": "https://bookhoard.example.com/opds",
|
||||
"api_base_url": "https://bookhoard.example.com/api"
|
||||
})
|
||||
auth: {
|
||||
type: bearer
|
||||
bearer: {{admin_token}}
|
||||
}
|
||||
}
|
||||
|
||||
assert {
|
||||
response.status == 200
|
||||
response.body.status == "success"
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
if (res.getStatus() === 200) {
|
||||
const body = res.getBody();
|
||||
tests('Status is success', body.status === "success");
|
||||
}
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Update System Configuration
|
||||
|
||||
Updates system-wide configuration settings for the Bookhoard instance.
|
||||
|
||||
**Method:** PUT
|
||||
|
||||
**Endpoint:** /api/system/config
|
||||
|
||||
**Authentication:** Bearer token (admin only)
|
||||
|
||||
**Request Body:**
|
||||
- `base_url` (string): Base URL for the instance
|
||||
- `opds_base_url` (string): OPDS endpoint base URL
|
||||
- `api_base_url` (string): API endpoint base URL
|
||||
|
||||
**Response:**
|
||||
- `status` (string): Update status
|
||||
- `config` (object): Updated configuration
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 400: Invalid configuration
|
||||
- 401: Unauthorized
|
||||
- 403: Forbidden (admin only)
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user