- Update Login User.bru to use testuser@example.com - Update Register User.bru to use testuser@example.com - Update Register Admin User.bru to use maxdevices@example.com - Standardize password to Test@Pass123! across all tests - Add TEST_DATA.md documenting shared test credentials - Update bruno.json with documentation reference - Add comments linking to TEST_DATA.md for cross-reference This alignment makes it easier to verify test failures between Bruno API tests and Go integration tests using identical credentials.
69 lines
1.3 KiB
Plaintext
69 lines
1.3 KiB
Plaintext
meta {
|
|
name: Login User
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
post {
|
|
url: {{base_url}}/api/auth/login
|
|
body: json
|
|
auth: inherit
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"login": "testuser@example.com",
|
|
"password": "Test@Pass123!"
|
|
}
|
|
}
|
|
|
|
// Test credentials align with Go integration tests
|
|
// See TEST_DATA.md for shared test data documentation
|
|
|
|
script:post-response {
|
|
function onResponse(res) {
|
|
let data = res.getBody();
|
|
// If successful registration, set token environment variable
|
|
if (res.getStatus() === 201 || res.getStatus() === 200) {
|
|
if (data && data.access_token) {
|
|
|
|
return bru.setEnvVar("token", data.access_token, { persist: true });
|
|
}
|
|
}
|
|
}
|
|
onResponse(res);
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Login User
|
|
|
|
Authenticates a user with email/username and password.
|
|
|
|
**Method:** POST
|
|
|
|
**Endpoint:** /api/auth/login
|
|
|
|
**Request Body:**
|
|
- `login` (string): Email or username
|
|
- `password` (string): Password
|
|
|
|
**Response:**
|
|
- `token` (string): JWT token
|
|
- `user` (object): User details
|
|
- `id` (string): User ID
|
|
- `email` (string): Email
|
|
- `username` (string): Username
|
|
- `theme` (string): User theme preference
|
|
- `first_name` (string): First name
|
|
- `last_name` (string): Last name
|
|
|
|
**Status Codes:**
|
|
- 200: Success
|
|
- 401: Invalid credentials
|
|
}
|