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

42 lines
852 B
Plaintext

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