Files
mtusi2026lab2/bruno/auth/register-second-user.bru
T
2026-10-09 15:48:03 +03:00

43 lines
902 B
Plaintext

meta {
name: Register second user
type: http
seq: 2
}
post {
url: {{baseUrl}}/api/v1/users
body: json
auth: none
}
docs {
Второй пользователь: нужен для чата с двумя участниками и проверки,
что чужой чат отдаёт 404. Сохраняет secondUserId и secondUsername,
используя тот же пароль.
}
script:pre-request {
if (!bru.getVar("suffix")) {
bru.setVar("suffix", Math.random().toString(36).slice(2, 10));
}
bru.setVar("secondUsername", `demo2_${bru.getVar("suffix")}`);
}
body:json {
{
"username": "{{secondUsername}}",
"display_name": "Второй участник",
"password": "{{password}}"
}
}
tests {
test("201 created", function() {
expect(res.status).to.equal(201);
});
}
script:post-response {
bru.setVar("secondUserId", res.body.id);
}