forked from mtusi2026/mtusi2026lab2
feat: lab2 done
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user