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
+46
View File
@@ -0,0 +1,46 @@
meta {
name: Create session (Basic)
type: http
seq: 4
}
post {
url: {{baseUrl}}/api/v1/auth/sessions
body: none
auth: basic
}
auth:basic {
username: {{username}}
password: {{password}}
}
docs {
Вход: Authorization: Basic base64(username:password), тело запроса не передаётся.
Пароль кодируется как UTF-8, разделитель — первый символ ":".
Сохраняет token и expiresAt. Неверные credentials дают 401 с
WWW-Authenticate: Basic realm="messenger", charset="UTF-8".
}
tests {
test("201 created", function() {
expect(res.status).to.equal(201);
});
test("token_type bearer", function() {
expect(res.body.token_type).to.equal("Bearer");
});
test("expires_at в UTC", function() {
expect(res.body.expires_at).to.match(/Z$/);
});
test("user совпадает с зарегистрированным", function() {
expect(res.body.user.id).to.equal(bru.getVar("userId"));
});
}
script:post-response {
bru.setVar("token", res.body.token);
bru.setVar("expiresAt", res.body.expires_at);
}