fix comments
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-10-23 22:32:15 +03:00
parent 5c193f24f7
commit c4ffc8dcf3
8 changed files with 327 additions and 15 deletions
+18
View File
@@ -69,6 +69,24 @@ class RequestBodies(unittest.TestCase):
with self.subTest(path=path, length=len(str(body))):
self.assert_invalid(self.api.call("POST", path, [400], actor=self.alice, body=body))
def test_nul_is_refused_before_it_reaches_the_store(self):
"""U+0000 не хранится в `text`: это 400, а не ложная недоступность базы."""
nul = "x\u0000y"
self.assert_invalid(self.api.call(
"POST", "/api/v1/users", [400],
body={"username": harness.unique("nul"), "display_name": nul,
"password": harness.fresh_password()},
))
self.assert_invalid(self.api.call(
"POST", "/api/v1/chats", [400], actor=self.alice,
body={"title": nul, "member_ids": [self.alice["id"]]},
))
chat = harness.chat(self.api, self.alice, [], title="NUL в сообщении")
self.assert_invalid(self.api.call(
"POST", "/api/v1/chats/" + chat["id"] + "/messages", [400],
actor=self.alice, body={"text": nul},
))
def test_message_text_limits(self):
chat = harness.chat(self.api, self.alice, [], title="Лимиты текста")
for text in ("x" * 4001, " ", ""):