Phase 12 - Bruno API Tests Standardization Convert all custom section builder tests to .yml format: - preview-collection.bru → preview-collection.yml - create-custom-section-manual.bru → create-custom-section-manual.yml - create-custom-section-missing-fields.bru → create-custom-section-missing-fields.yml - create-custom-section-rules.bru → create-custom-section-rules.yml All Bruno tests now consistently use .yml extension across the project. Tests cover: - Preview collection with filter rules - Create collection with manual book selection - Validation of required fields - Multiple filter rules with operators Part of Carousel Dashboard Plan completion
48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
meta:
|
|
name: Create Custom Section with Manual Books
|
|
type: http
|
|
seq: 2
|
|
http:
|
|
method: POST
|
|
url: '{{base_url}}/api/collections'
|
|
auth: inherit
|
|
body:
|
|
type: json
|
|
jsonBody: "{\n \"library_id\": \"{{library_id}}\",\n \"name\": \"My Favorites\"\
|
|
,\n \"icon\": \"⭐\",\n \"description\": \"My favorite books\",\n \"show_on_dashboard\"\
|
|
: true,\n \"auto_assign_rules\": \"\",\n \"manual_book_ids\": [\"{{media_item_id}}\"\
|
|
],\n \"match_type\": \"all\"\n}"
|
|
runtime:
|
|
scripts:
|
|
- type: tests
|
|
code: "test(\"status must be 201 with valid request\", function() {\n expect(res.status).to.eql(201);\n\
|
|
});\n\ntest(\"response contains collection id\", function() {\n expect(res.body.id).to.exist;\n\
|
|
expect(res.body.id).to.be.a('string');\n });\n\ntest(\"response contains\
|
|
\ collection name\", function() {\n expect(res.body.name).to.eql(\"My Favorites\"\
|
|
);\n });"
|
|
|
|
docs: |-
|
|
Create a custom collection with manually selected books.
|
|
|
|
**Endpoint**: POST /api/collections
|
|
**Auth**: Required (Bearer token)
|
|
|
|
## Example Request
|
|
|
|
```json
|
|
{
|
|
"library_id": "cc23c3a7-f8fb-451a-a78d-2a16df1b725a",
|
|
"name": "My Favorites",
|
|
"icon": "⭐",
|
|
"description": "My favorite books",
|
|
"show_on_dashboard": true,
|
|
"auto_assign_rules": "",
|
|
"manual_book_ids": ["book-id-1", "book-id-2"],
|
|
"match_type": "all"
|
|
}
|
|
```
|
|
|
|
## Response
|
|
|
|
Returns the created collection with generated ID.
|