forked from mtusi2026/mtusi2026lab3
feat: конф нгинкс, тесты, ключ идмпт etc
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
from helpers import assert_error, auth
|
||||
from helpers import assert_error, auth, message_headers
|
||||
|
||||
PASSWORD = "Valid-password-123"
|
||||
|
||||
@@ -32,8 +32,16 @@ def test_malformed_json_on_create_chat_and_message(
|
||||
assert_error(
|
||||
api.post("/api/v1/chats", content=raw, headers=headers), 400, "invalid_request"
|
||||
)
|
||||
message_post_headers = {
|
||||
**message_headers(alice),
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
assert_error(
|
||||
api.post(f"/api/v1/chats/{chat['id']}/messages", content=raw, headers=headers),
|
||||
api.post(
|
||||
f"/api/v1/chats/{chat['id']}/messages",
|
||||
content=raw,
|
||||
headers=message_post_headers,
|
||||
),
|
||||
400,
|
||||
"invalid_request",
|
||||
)
|
||||
@@ -78,7 +86,9 @@ def test_invalid_message_payload(
|
||||
alice = make_user("alice")
|
||||
chat = make_chat(alice, [alice])
|
||||
response = api.post(
|
||||
f"/api/v1/chats/{chat['id']}/messages", json=body, headers=auth(alice)
|
||||
f"/api/v1/chats/{chat['id']}/messages",
|
||||
json=body,
|
||||
headers=message_headers(alice),
|
||||
)
|
||||
assert_error(response, 400, "invalid_request")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user