forked from mtusi2026/mtusi2026lab2
feat: lab2 done
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
meta {
|
||||
name: Send message
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/api/v1/chats/{{chatId}}/messages
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{token}}
|
||||
}
|
||||
|
||||
docs {
|
||||
Отправитель берётся из Bearer-идентичности; поле sender_id в теле
|
||||
не принимается (лишние поля — 400). Пустой или пробельный текст — 400.
|
||||
Запись коммитит сообщение и увеличивает chats.message_version в одной
|
||||
транзакции. Сохраняет messageId.
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"text": "Привет из Bruno 👋"
|
||||
}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("201 created", function() {
|
||||
expect(res.status).to.equal(201);
|
||||
});
|
||||
|
||||
test("sender выведен из сессии", function() {
|
||||
expect(res.body.sender_id).to.equal(bru.getVar("userId"));
|
||||
});
|
||||
|
||||
test("сообщение в нужном чате", function() {
|
||||
expect(res.body.chat_id).to.equal(bru.getVar("chatId"));
|
||||
});
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
bru.setVar("messageId", res.body.id);
|
||||
}
|
||||
Reference in New Issue
Block a user