Проверять аутентификацию раньше валидации тела запроса
Skeleton contracts / contracts (pull_request) Canceled after 0s
Application / stack (pull_request) Canceled after 0s

This commit is contained in:
Pavel Grigorev
2026-10-30 16:50:30 +03:00
parent c8d078390c
commit cd81572950
7 changed files with 36 additions and 18 deletions
+4 -2
View File
@@ -1,5 +1,5 @@
# python -m unittest discover -s student-tests -v
# date: 2026-10-29T09:20:03Z; host: Windows 10, Docker Desktop 27.2.0, 12 CPU / 1.9 GiB for Docker VM
# date: 2026-10-30T13:48:04Z; host: Windows 10, Docker Desktop 27.2.0, 12 CPU / 1.9 GiB for Docker VM
test_duplicate_username (test_api.DuplicateUsernameTest.test_duplicate_username)
Повторная регистрация того же username -> 409 conflict ... ok
@@ -37,6 +37,8 @@ test_invalid_cursor_and_limit (test_api.PaginationTest.test_invalid_cursor_and_l
Мусорный cursor и limit вне 1..100 -> 400 ... ok
test_walk_several_pages (test_api.PaginationTest.test_walk_several_pages)
7 сообщений по 3: три страницы, без потерь, повторов и перестановок ... ok
test_authentication_before_validation (test_auth.BearerTest.test_authentication_before_validation)
Аноним с битым JSON на защищённом endpoint получает 401, а не 400; с сессией — 400 ... ok
test_only_bearer_is_accepted (test_auth.BearerTest.test_only_bearer_is_accepted)
Нет заголовка, Basic, X-User-Id, мусорный токен -> 401 Bearer ... ok
test_scheme_is_case_insensitive (test_auth.BearerTest.test_scheme_is_case_insensitive)
@@ -75,7 +77,7 @@ test_secrets_are_not_stored_in_plaintext (test_db.DatabaseTest.test_secrets_are_
В users лежит argon2id-хеш, в sessions — sha256 токена, не сам токен ... ok
----------------------------------------------------------------------
Ran 36 tests in 11.556s
Ran 37 tests in 11.022s
OK