This commit is contained in:
@@ -52,6 +52,19 @@ class Registration(unittest.TestCase):
|
||||
session = harness.login(self.api, payload["username"], secret)
|
||||
self.assertEqual(session["user"]["username"], payload["username"])
|
||||
|
||||
def test_whitespace_only_password_is_refused(self):
|
||||
"""Двенадцать пробелов — пустое значение обязательного поля, а не пароль."""
|
||||
response = self.api.call("POST", "/api/v1/users", [400], body=self.body(" " * 12, "blank"))
|
||||
self.assertEqual(response["json"]["error"]["code"], "invalid_request")
|
||||
|
||||
def test_surrounding_spaces_are_part_of_the_password(self):
|
||||
"""Пароль не обрезается: пробелы по краям значат то же, что и любые другие символы."""
|
||||
secret = " " + "a" * 10 + " "
|
||||
payload = self.body(secret, "spaced")
|
||||
self.api.call("POST", "/api/v1/users", 201, body=payload)
|
||||
self.assertEqual(harness.login(self.api, payload["username"], secret)["token_type"],
|
||||
"Bearer")
|
||||
|
||||
def test_password_is_checked_to_the_last_byte(self):
|
||||
"""Пароль длиннее 72 байт не усекается KDF.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user