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,85 +1,57 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Logout User",
|
||||
"type": "http",
|
||||
"seq": 1,
|
||||
"auth": "Inherit"
|
||||
},
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "json",
|
||||
"json": {
|
||||
"refresh_token": "{{refresh_token}}"
|
||||
}
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/api/auth/logout",
|
||||
"host": ["{{base_url}}"],
|
||||
"path": ["api", "auth", "logout"]
|
||||
},
|
||||
"description": "Logs out the user by revoking their refresh token. If no refresh token is provided, the request succeeds but no token is revoked."
|
||||
},
|
||||
"response": [
|
||||
{
|
||||
"name": "Success Response",
|
||||
"originalRequest": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"body": {
|
||||
"type": "json",
|
||||
"json": {
|
||||
"refresh_token": "valid-refresh-token-uuid"
|
||||
}
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/api/auth/logout",
|
||||
"host": ["{{base_url}}"],
|
||||
"path": ["api", "auth", "logout"]
|
||||
}
|
||||
},
|
||||
"status": 200,
|
||||
"code": 200,
|
||||
"header": [
|
||||
{
|
||||
"name": "content-type",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": "{\n \"message\": \"logged out successfully\"\n}",
|
||||
"description": "Successfully logged out and refresh token revoked."
|
||||
},
|
||||
{
|
||||
"name": "Logout Without Refresh Token",
|
||||
"originalRequest": {
|
||||
"method": "POST",
|
||||
"header": [],
|
||||
"body": {
|
||||
"type": "json",
|
||||
"json": {}
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/api/auth/logout",
|
||||
"host": ["{{base_url}}"],
|
||||
"path": ["api", "auth", "logout"]
|
||||
}
|
||||
},
|
||||
"status": 200,
|
||||
"code": 200,
|
||||
"header": [
|
||||
{
|
||||
"name": "content-type",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": "{\n \"message\": \"logged out successfully\"\n}",
|
||||
"description": "Logout succeeds even without a refresh token."
|
||||
}
|
||||
]
|
||||
meta {
|
||||
name: Logout User
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{base_url}}/api/auth/logout
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"refresh_token": "{{refresh_token}}"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Logout User
|
||||
|
||||
Logs out the user by revoking their refresh token. If no refresh token is provided, the request succeeds but no token is revoked.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/auth/logout
|
||||
|
||||
**Authentication:** Bearer token (optional)
|
||||
|
||||
**Request Body:**
|
||||
- `refresh_token` (string, optional): Refresh token to revoke
|
||||
|
||||
**Response:**
|
||||
- `message` (string): Success message
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success - user logged out (token revoked if provided)
|
||||
- 401: Unauthorized
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
"message": "logged out successfully"
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** The access token will expire naturally after 1 hour. The refresh token is immediately revoked on logout, preventing future token refreshes.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user