fix(api): return 422 for validation errors with serializable payloads [FASE-3.3]

This commit is contained in:
2026-05-18 14:16:53 +02:00
parent 6b076f52b2
commit 5b29c2fc56
3 changed files with 86 additions and 5 deletions

View File

@@ -42,6 +42,14 @@ class TestUsernameValidation:
with pytest.raises(ValidationError, match="3-50 characters"):
UserCreate(username="john@doe", password="SecurePass123!@#")
def test_reserved_username_system(self):
with pytest.raises(ValidationError):
UserCreate(username="system", password="SecurePass123!@#")
def test_invalid_username_path_chars(self):
with pytest.raises(ValidationError):
UserCreate(username="../admin", password="SecurePass123!@#")
def test_reserved_username_admin(self):
with pytest.raises(ValidationError, match="reserved"):
UserCreate(username="admin", password="SecurePass123!@#")