forked from mtusi2026/mtusi2026lab2
35 lines
685 B
Plaintext
35 lines
685 B
Plaintext
meta {
|
|
name: Duplicate username returns 409
|
|
type: http
|
|
seq: 8
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/v1/users
|
|
body: json
|
|
auth: none
|
|
}
|
|
|
|
docs {
|
|
Повторная регистрация того же username. Уникальность обеспечивает
|
|
unique-индекс PostgreSQL, ошибка 23505 маппится в 409 (не 500).
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"username": "{{username}}",
|
|
"display_name": "Дубликат",
|
|
"password": "{{password}}"
|
|
}
|
|
}
|
|
|
|
tests {
|
|
test("409 conflict", function() {
|
|
expect(res.status).to.equal(409);
|
|
});
|
|
|
|
test("код ошибки conflict", function() {
|
|
expect(res.body.error.code).to.equal("conflict");
|
|
});
|
|
}
|