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
+56 -84
View File
@@ -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.
}
+67 -86
View File
@@ -1,87 +1,68 @@
{
"meta": {
"name": "Refresh Access Token",
"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/refresh",
"host": ["{{base_url}}"],
"path": ["api", "auth", "refresh"]
},
"description": "Refreshes an access token using a valid refresh token. Returns a new access token with 1-hour expiration."
},
"response": [
{
"name": "Success Response",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"type": "json",
"json": {
"refresh_token": "valid-refresh-token-uuid"
}
},
"url": {
"raw": "{{base_url}}/api/auth/refresh",
"host": ["{{base_url}}"],
"path": ["api", "auth", "refresh"]
}
},
"status": 200,
"code": 200,
"header": [
{
"name": "content-type",
"value": "application/json"
}
],
"body": "{\n \"access_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\",\n \"token_type\": \"Bearer\",\n \"expires_in\": 3600\n}",
"description": "Returns a new access token that expires in 1 hour (3600 seconds)."
},
{
"name": "Invalid Refresh Token",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"type": "json",
"json": {
"refresh_token": "invalid-token"
}
},
"url": {
"raw": "{{base_url}}/api/auth/refresh",
"host": ["{{base_url}}"],
"path": ["api", "auth", "refresh"]
}
},
"status": 401,
"code": 401,
"header": [
{
"name": "content-type",
"value": "application/json"
}
],
"body": "{\n \"error\": \"invalid or expired refresh token\"\n}",
"description": "Returned when the refresh token is invalid, expired, or has been revoked."
}
]
meta {
name: Refresh Access Token
type: http
seq: 1
}
post {
url: {{base_url}}/api/auth/refresh
body: json
auth: inherit
}
headers {
Content-Type: application/json
}
body:json {
{
"refresh_token": "{{refresh_token}}"
}
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Refresh Access Token
Refreshes an access token using a valid refresh token. Returns a new access token with 1-hour expiration.
**Method:** POST
**Endpoint:** /api/auth/refresh
**Authentication:** Not required (refresh token is in request body)
**Request Body:**
- `refresh_token` (string): Valid refresh token UUID
**Response:**
- `access_token` (string): New JWT access token (1 hour expiration)
- `token_type` (string): Token type (usually "Bearer")
- `expires_in` (number): Token lifetime in seconds (3600)
**Status Codes:**
- 200: Success - new access token generated
- 401: Unauthorized - invalid or expired refresh token
**Example Response (Success):**
```json
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}
```
**Example Response (Invalid Token):**
```json
{
"error": "invalid or expired refresh token"
}
```
**Note:** Access tokens expire after 1 hour. Use the refresh token to obtain a new access token without requiring the user to log in again.
}