forked from mtusi2026/mtusi2026lab2
fix: 503 при сбое зависимостей, таймаут пула pg, сохранение NUL символа в сообщениях
This commit is contained in:
+10
-10
@@ -394,16 +394,16 @@ async def test_unsupported_media_type_415(client: httpx.AsyncClient):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_nul_byte_in_strings_handled(client: httpx.AsyncClient):
|
||||
"""Символ \\u0000 в строках не должен вызывать 500/503 и должен корректно обрабатываться."""
|
||||
u = f"nul_user_{uuid.uuid4().hex[:6]}"
|
||||
res = await client.post(
|
||||
"/api/v1/users",
|
||||
json={"username": u, "display_name": "Hello\u0000World", "password": "Password123456!"},
|
||||
)
|
||||
assert res.status_code == 201
|
||||
data = res.json()
|
||||
assert data["username"] == u
|
||||
assert data["display_name"] == "HelloWorld"
|
||||
usr = await register_and_login(client, f"nul_msg_{uuid.uuid4().hex[:4]}")
|
||||
chat = (await client.post("/api/v1/chats", headers=usr["headers"], json={"title": "NulChat", "member_ids": [usr["user"]["id"]]})).json()
|
||||
test_text = "left\u0000right"
|
||||
msg_res = await client.post(f"/api/v1/chats/{chat['id']}/messages", headers=usr["headers"], json={"text": test_text})
|
||||
assert msg_res.status_code == 201
|
||||
assert msg_res.json()["text"] == test_text
|
||||
|
||||
list_res = await client.get(f"/api/v1/chats/{chat['id']}/messages", headers=usr["headers"])
|
||||
assert list_res.status_code == 200
|
||||
assert any(m["text"] == test_text for m in list_res.json()["items"])
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user