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:
@@ -7,35 +7,31 @@ meta {
|
||||
delete {
|
||||
url: {{base_url}}/api/queue/devices/{{device_id}}/clear
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## Clear Device Queue
|
||||
|
||||
|
||||
Clears all queue items for a specific device.
|
||||
|
||||
|
||||
**Method:** DELETE
|
||||
|
||||
|
||||
**Endpoint:** /api/queue/devices/:device_id/clear
|
||||
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
|
||||
**Path Parameters:**
|
||||
- `device_id` (string): Device UUID
|
||||
|
||||
|
||||
**Response:**
|
||||
- Success message with count of cleared items
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Device not found
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -7,35 +7,31 @@ meta {
|
||||
delete {
|
||||
url: {{base_url}}/api/queue/items/{{item_id}}
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## Delete Queue Item
|
||||
|
||||
|
||||
Deletes a queue item from the sync queue.
|
||||
|
||||
|
||||
**Method:** DELETE
|
||||
|
||||
|
||||
**Endpoint:** /api/queue/items/:item_id
|
||||
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
|
||||
**Path Parameters:**
|
||||
- `item_id` (string): Queue item UUID
|
||||
|
||||
|
||||
**Response:**
|
||||
- Success message confirming deletion
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Queue item not found
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
meta {
|
||||
name: Filter by Status - Pending
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
docs {
|
||||
Filter queue items by status - show only pending items.
|
||||
|
||||
**Endpoint**: GET /queue/items?status=pending
|
||||
**Auth**: Required (Bearer token)
|
||||
|
||||
## Query Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|-----------|-------------|
|
||||
| status | string | Yes | Status filter: pending, processing, completed, failed |
|
||||
|
||||
## Response Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| items | array | List of queue items with pending status |
|
||||
| total | int | Total matching items |
|
||||
|
||||
## Example Request
|
||||
|
||||
```
|
||||
GET /queue/items?status=pending
|
||||
```
|
||||
|
||||
## Example Response
|
||||
|
||||
```json
|
||||
{
|
||||
"items": [...],
|
||||
"total": 15
|
||||
}
|
||||
```
|
||||
|
||||
## Error Responses
|
||||
|
||||
| Code | Description |
|
||||
|------|-------------|
|
||||
| 401 | Unauthorized |
|
||||
| 500 | Internal server error |
|
||||
|
||||
## Notes
|
||||
|
||||
- Only returns items with the specified status
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{base_url}}/queue/items?status=pending
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
token: {{jwt_token}}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("status must be 200", function() {
|
||||
expect(res.status).to.eql(200);
|
||||
});
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -7,35 +7,31 @@ meta {
|
||||
get {
|
||||
url: {{base_url}}/api/queue/devices/{{device_id}}/stats
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## Get Device Queue Stats
|
||||
|
||||
|
||||
Retrieves statistics for a specific device's sync queue.
|
||||
|
||||
|
||||
**Method:** GET
|
||||
|
||||
|
||||
**Endpoint:** /api/queue/devices/:device_id/stats
|
||||
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
|
||||
**Path Parameters:**
|
||||
- `device_id` (string): Device UUID
|
||||
|
||||
|
||||
**Response:**
|
||||
- Queue statistics including pending, completed, and failed counts
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Device not found
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -7,32 +7,28 @@ meta {
|
||||
get {
|
||||
url: {{base_url}}/api/queue/items
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## List All Queue Items (Admin)
|
||||
|
||||
|
||||
Retrieves all queue items across all devices (admin only).
|
||||
|
||||
|
||||
**Method:** GET
|
||||
|
||||
|
||||
**Endpoint:** /api/queue/items
|
||||
|
||||
|
||||
**Authentication:** Bearer token (admin role required)
|
||||
|
||||
|
||||
**Response:**
|
||||
- Array of queue items with device and status information
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 403: Forbidden - admin role required
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
[
|
||||
|
||||
@@ -7,35 +7,31 @@ meta {
|
||||
get {
|
||||
url: {{base_url}}/api/queue/devices/{{device_id}}/items
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## List Device Queue Items
|
||||
|
||||
|
||||
Retrieves all queue items for a specific device.
|
||||
|
||||
|
||||
**Method:** GET
|
||||
|
||||
|
||||
**Endpoint:** /api/queue/devices/:device_id/items
|
||||
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
|
||||
**Path Parameters:**
|
||||
- `device_id` (string): Device UUID
|
||||
|
||||
|
||||
**Response:**
|
||||
- Array of queue items for the specified device
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Device not found
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
[
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
meta {
|
||||
name: List Queue Items (With Pagination)
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
docs {
|
||||
List items in the sync queue with pagination.
|
||||
|
||||
**Endpoint**: GET /queue/items
|
||||
**Auth**: Required (Bearer token)
|
||||
|
||||
## Query Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|-----------|-------------|
|
||||
| limit | int | No | Items per page |
|
||||
| offset | int | No | Pagination offset |
|
||||
|
||||
## Response Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| items | array | List of queue items |
|
||||
| total | int | Total number of items |
|
||||
| page | int | Current page number |
|
||||
| per_page | int | Items per page |
|
||||
|
||||
## Example Request
|
||||
|
||||
```
|
||||
GET /queue/items?limit=50&offset=0
|
||||
```
|
||||
|
||||
## Error Responses
|
||||
|
||||
| Code | Description |
|
||||
|------|-------------|
|
||||
| 401 | Unauthorized |
|
||||
| 500 | Internal server error |
|
||||
|
||||
## Notes
|
||||
|
||||
- Supports pagination for large queue lists
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{base_url}}/queue/items?limit=50&offset=0
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
token: {{jwt_token}}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("status must be 200", function() {
|
||||
expect(res.status).to.eql(200);
|
||||
});
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -7,36 +7,32 @@ meta {
|
||||
post {
|
||||
url: {{base_url}}/api/queue/items/{{item_id}}/retry
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## Retry Queue Item
|
||||
|
||||
|
||||
Retries a failed queue item.
|
||||
|
||||
|
||||
**Method:** POST
|
||||
|
||||
|
||||
**Endpoint:** /api/queue/items/:item_id/retry
|
||||
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
|
||||
**Path Parameters:**
|
||||
- `item_id` (string): Queue item UUID
|
||||
|
||||
|
||||
**Response:**
|
||||
- Success message indicating retry initiated
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Queue item not found
|
||||
- 400: Invalid item status
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user