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. }