feat: конф нгинкс, тесты, ключ идмпт etc

This commit is contained in:
Enterxx2
2026-10-20 10:41:56 +03:00
parent aa971fbd27
commit b53e5d1077
63 changed files with 5013 additions and 153 deletions
+6 -4
View File
@@ -2,7 +2,7 @@
import httpx
import pytest
from helpers import assert_error, auth
from helpers import assert_error, auth, message_headers
@pytest.mark.parametrize("text", ["", " ", " \n\t ", " "])
@@ -12,7 +12,9 @@ def test_empty_or_blank_message_is_rejected(
alice = make_user("alice")
chat = make_chat(alice, [alice])
response = api.post(
f"/api/v1/chats/{chat['id']}/messages", json={"text": text}, headers=auth(alice)
f"/api/v1/chats/{chat['id']}/messages",
json={"text": text},
headers=message_headers(alice),
)
assert_error(response, 400, "invalid_request")
history = api.get(f"/api/v1/chats/{chat['id']}/messages", headers=auth(alice))
@@ -29,7 +31,7 @@ def test_message_length_is_counted_in_code_points(
response = api.post(
f"/api/v1/chats/{chat['id']}/messages",
json={"text": "😀" * 4001},
headers=auth(alice),
headers=message_headers(alice),
)
assert_error(response, 400, "invalid_request")
@@ -56,7 +58,7 @@ def test_nul_character_is_rejected(api: httpx.Client, make_user, make_chat) -> N
response = api.post(
f"/api/v1/chats/{chat['id']}/messages",
json={"text": "до\u0000после"},
headers=auth(alice),
headers=message_headers(alice),
)
assert_error(response, 400, "invalid_request")
response = api.post(