test(bruno): update API tests for /api/media-items/ endpoints
- Update bulk-delete test: endpoint URL, request field (book_ids → media_item_ids), response field (success → deleted), documentation - Update bulk-update test: endpoint URL, request structure (updates → media_item_updates), response field (success → updated), documentation - Update download test: endpoint URL (/api/books/ → /api/media-items/), documentation
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
meta {
|
||||
name: Bulk Update Books
|
||||
name: Bulk Update Media Items
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{base_url}}/api/books/bulk-update
|
||||
url: {{base_url}}/api/media-items/bulk-update
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
@@ -16,9 +16,9 @@ headers {
|
||||
|
||||
body:json {
|
||||
{
|
||||
"updates": [
|
||||
"media_item_updates": [
|
||||
{
|
||||
"book_id": "{{bookId1}}",
|
||||
"media_item_id": "{{bookId1}}",
|
||||
"updates": {
|
||||
"title": "Updated Title",
|
||||
"genre": "Science Fiction",
|
||||
@@ -26,7 +26,7 @@ body:json {
|
||||
}
|
||||
},
|
||||
{
|
||||
"book_id": "{{bookId2}}",
|
||||
"media_item_id": "{{bookId2}}",
|
||||
"updates": {
|
||||
"author": "Updated Author",
|
||||
"contributors": ["O'Reilly Media", "Penguin Random House"]
|
||||
@@ -43,7 +43,7 @@ script:post-response {
|
||||
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 updated count'] = body.updated !== undefined;
|
||||
} else {
|
||||
tests['Bulk update failed'] = false;
|
||||
}
|
||||
@@ -57,25 +57,25 @@ settings {
|
||||
}
|
||||
|
||||
docs {
|
||||
## Bulk Update Books
|
||||
## Bulk Update Media Items
|
||||
|
||||
Updates multiple books in a single request with different fields for each book.
|
||||
Updates multiple media items in a single request with different fields for each item.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/books/bulk-update
|
||||
**Endpoint:** /api/media-items/bulk-update
|
||||
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Request Body:**
|
||||
- `updates` (array): Array of update objects
|
||||
- `book_id` (string): Book UUID to update
|
||||
- `media_item_updates` (array): Array of update objects
|
||||
- `media_item_id` (string): Media item 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
|
||||
- `total` (number): Total number of media items processed
|
||||
- `updated` (number): Number of successfully updated media items
|
||||
- `failed` (number): Number of failed updates
|
||||
|
||||
**Status Codes:**
|
||||
@@ -88,9 +88,9 @@ docs {
|
||||
**Example:**
|
||||
```json
|
||||
{
|
||||
"updates": [
|
||||
"media_item_updates": [
|
||||
{
|
||||
"book_id": "uuid-1",
|
||||
"media_item_id": "uuid-1",
|
||||
"updates": {
|
||||
"title": "New Title",
|
||||
"genre": "Fiction",
|
||||
@@ -98,7 +98,7 @@ docs {
|
||||
}
|
||||
},
|
||||
{
|
||||
"book_id": "uuid-2",
|
||||
"media_item_id": "uuid-2",
|
||||
"updates": {
|
||||
"author": "Jane Doe",
|
||||
"contributors": ["Publisher Inc."]
|
||||
@@ -108,5 +108,5 @@ docs {
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** Each book can have different fields updated. Only the specified fields are modified for each book.
|
||||
**Note:** Each media item can have different fields updated. Only the specified fields are modified for each item.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user