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
+82 -38
View File
@@ -1,41 +1,85 @@
{
"meta": {
"name": "Bulk Delete Books",
"type": "http",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Test bulk delete response",
"if (response.status === 200) {",
" tests['Bulk delete successful'] = true;",
" const body = JSON.parse(response.body);",
" tests['Has results array'] = Array.isArray(body.results);",
" tests['Has total count'] = body.total !== undefined;",
" tests['Has success count'] = body.success !== undefined;",
" tests['Has failed count'] = body.failed !== undefined;",
"} else {",
" tests['Bulk delete failed'] = false;",
"}"
]
}
}
meta {
name: Bulk Delete Books
type: http
seq: 1
}
post {
url: {{baseUrl}}/api/books/bulk-delete
body: json
auth: inherit
}
headers {
Content-Type: application/json
}
body:json {
{
"book_ids": [
"{{bookId1}}",
"{{bookId2}}",
"{{bookId3}}"
]
},
"req": {
"url": "{{baseUrl}}/api/books/bulk-delete",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{authToken}}"
},
"body": {
"book_ids": [
"{{bookId1}}",
"{{bookId2}}",
"{{bookId3}}"
]
}
}
}
script:post-response {
function onResponse(res) {
if (res.getStatus() === 200) {
tests['Bulk delete successful'] = true;
const body = res.getBody();
tests['Has results array'] = Array.isArray(body.results);
tests['Has total count'] = body.total !== undefined;
tests['Has success count'] = body.success !== undefined;
tests['Has failed count'] = body.failed !== undefined;
} else {
tests['Bulk delete failed'] = false;
}
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Bulk Delete Books
Deletes multiple books in a single request.
**Method:** POST
**Endpoint:** /api/books/bulk-delete
**Authentication:** Required (Bearer token)
**Request Body:**
- `book_ids` (array of strings): Array of book UUIDs to delete
**Response:**
- `results` (array): Results for each deletion attempt
- `total` (number): Total number of books processed
- `success` (number): Number of successfully deleted books
- `failed` (number): Number of failed deletions
**Status Codes:**
- 200: Success (with partial results if some failed)
- 400: Invalid request data
- 401: Unauthorized
- 403: Forbidden
- 500: Internal server error
**Example:**
```json
{
"book_ids": [
"uuid-1",
"uuid-2",
"uuid-3"
]
}
```
}
+106 -46
View File
@@ -1,52 +1,112 @@
{
"meta": {
"name": "Bulk Update Books",
"type": "http",
"event": [
meta {
name: Bulk Update Books
type: http
seq: 2
}
post {
url: {{baseUrl}}/api/books/bulk-update
body: json
auth: inherit
}
headers {
Content-Type: application/json
}
body:json {
{
"updates": [
{
"listen": "test",
"script": {
"exec": [
"// Test bulk update response",
"if (response.status === 200) {",
" tests['Bulk update successful'] = true;",
" const body = JSON.parse(response.body);",
" tests['Has results array'] = Array.isArray(body.results);",
" tests['Has total count'] = body.total !== undefined;",
" tests['Has success count'] = body.success !== undefined;",
"} else {",
" tests['Bulk update failed'] = false;",
"}"
]
"book_id": "{{bookId1}}",
"updates": {
"title": "Updated Title",
"genre": "Science Fiction",
"tags": ["science fiction", "non-fiction", "ACME CORP."]
}
},
{
"book_id": "{{bookId2}}",
"updates": {
"author": "Updated Author",
"contributors": ["O'Reilly Media", "Penguin Random House"]
}
}
]
},
"req": {
"url": "{{baseUrl}}/api/books/bulk-update",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{authToken}}"
},
"body": {
"updates": [
{
"book_id": "{{bookId1}}",
"updates": {
"title": "Updated Title",
"genre": "Science Fiction",
"tags": ["science fiction", "non-fiction", "ACME CORP."]
}
},
{
"book_id": "{{bookId2}}",
"updates": {
"author": "Updated Author",
"contributors": ["O'Reilly Media", "Penguin Random House"]
}
}
]
}
}
}
script:post-response {
function onResponse(res) {
if (res.getStatus() === 200) {
tests['Bulk update successful'] = true;
const body = res.getBody();
tests['Has results array'] = Array.isArray(body.results);
tests['Has total count'] = body.total !== undefined;
tests['Has success count'] = body.success !== undefined;
} else {
tests['Bulk update failed'] = false;
}
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Bulk Update Books
Updates multiple books in a single request with different fields for each book.
**Method:** POST
**Endpoint:** /api/books/bulk-update
**Authentication:** Required (Bearer token)
**Request Body:**
- `updates` (array): Array of update objects
- `book_id` (string): Book UUID to update
- `updates` (object): Fields to update (can include title, author, genre, tags, contributors, etc.)
**Response:**
- `results` (array): Results for each update attempt
- `total` (number): Total number of books processed
- `success` (number): Number of successfully updated books
- `failed` (number): Number of failed updates
**Status Codes:**
- 200: Success (with partial results if some failed)
- 400: Invalid request data
- 401: Unauthorized
- 403: Forbidden
- 500: Internal server error
**Example:**
```json
{
"updates": [
{
"book_id": "uuid-1",
"updates": {
"title": "New Title",
"genre": "Fiction",
"tags": ["fiction", "adventure"]
}
},
{
"book_id": "uuid-2",
"updates": {
"author": "Jane Doe",
"contributors": ["Publisher Inc."]
}
}
]
}
```
**Note:** Each book can have different fields updated. Only the specified fields are modified for each book.
}