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