fix: добавлена проверка not_blank на пароль

This commit is contained in:
2026-10-24 13:07:35 +03:00
parent 33108249fa
commit 28bca0b270
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -34,9 +34,9 @@ class CreateUser(Strict):
display_name: str = Field(min_length=1, max_length=NAME_MAX)
password: str = Field(min_length=12, max_length=128)
@field_validator('display_name')
@field_validator('display_name', 'password')
@classmethod
def _display_name(cls, value: str) -> str:
def _not_blank(cls, value: str) -> str:
return not_blank(value)
+8
View File
@@ -10,6 +10,14 @@ def test_rejects_duplicate_username(actors):
client.call('POST', '/api/v1/users', 409, body=alice['registration'])
def test_rejects_blank_password(client):
response = client.call(
'POST', '/api/v1/users', 400,
body={'username': 'blank_password', 'display_name': 'Blank password', 'password': ' ' * 12},
)
assert response['json']['error']['code'] == 'invalid_request'
def test_hides_chat_from_outsider(actors):
client, _, _, eve, chat = actors
client.call('GET', '/api/v1/chats/' + chat['id'], 404, actor=eve)