fix(applications): reject boolean numeric input

This commit is contained in:
nyan404 committed 2026-08-25 04:02:09 +03:00
1 parent 093e0f6f73
commit 947cebc256
3 files changed
+12

No files matched your search

+9
View File
@@ -36,6 +36,15 @@ class ApplicationTests(unittest.TestCase):
"practiced_before": False, "vk_link": link,
})
def test_application_rejects_boolean_character_and_feather_ids(self) -> None:
with self.assertRaisesRegex(ApplicationError, "ID персонажа должно быть числом"):
validate_application({"type": "kitten", "name": "Муся", "character_id": True, "attachments": [{"url": "https://img.example.test/a.jpg"}]})
with self.assertRaisesRegex(ApplicationError, "Количество перьев должно быть числом"):
validate_application({
"type": "feather_donation", "name": "Муся", "character_id": 1337,
"feathers": [{"amount": True, "color": "синее", "source": "запасы"}],
})
def test_application_bounds_attachment_and_feather_fan_out(self) -> None:
too_many_attachments = [{"url": "https://img.example.test/photo.jpg"}] * (MAX_APPLICATION_ATTACHMENTS + 1)
with self.assertRaisesRegex(ApplicationError, "не более"):