feat: lab2 done

This commit is contained in:
2026-10-09 15:48:03 +03:00
parent f743ee10a2
commit 575f8ee386
104 changed files with 7038 additions and 1099 deletions
+53
View File
@@ -0,0 +1,53 @@
meta {
name: Register first user
type: http
seq: 1
}
post {
url: {{baseUrl}}/api/v1/users
body: json
auth: none
}
body:json {
{
"username": "{{username}}",
"display_name": "Демо-пользователь",
"password": "{{password}}"
}
}
vars:pre-request {
baseUrl: http://localhost:8080
}
script:pre-request {
if (!bru.getVar("suffix")) {
bru.setVar("suffix", Math.random().toString(36).slice(2, 10));
}
bru.setVar("username", `demo_${bru.getVar("suffix")}`);
}
script:post-response {
bru.setVar("userId", res.body.id);
bru.setVar("displayName", res.body.display_name);
}
tests {
test("201 created", function() {
expect(res.status).to.equal(201);
});
test("пароль и хеш не утекли", function() {
expect(res.body).to.not.have.property("password");
expect(res.body).to.not.have.property("password_hash");
});
}
docs {
Регистрация с паролем (12–128 code points).
Username генерируется из случайного суффикса, чтобы повторный запуск коллекции
не упирался в 409. Сохраняет переменные: username, userId, displayName.
Ответ никогда не содержит password или password_hash.
}