chore: standardize security and quality foundations
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import unittest
|
||||
|
||||
from pydantic import ValidationError
|
||||
|
||||
from backend.app.api_models import PasswordResetRequest, SignupRequest
|
||||
|
||||
|
||||
class ApiRequestModelTests(unittest.TestCase):
|
||||
def test_signup_rejects_unknown_fields(self) -> None:
|
||||
with self.assertRaises(ValidationError):
|
||||
SignupRequest(
|
||||
invite_code="invite",
|
||||
username="viewer",
|
||||
password="strong password",
|
||||
unexpected="value",
|
||||
)
|
||||
|
||||
def test_password_reset_preserves_password_whitespace_for_policy_validation(self) -> None:
|
||||
request = PasswordResetRequest(token="token", new_password=" leading and trailing ")
|
||||
self.assertEqual(request.new_password, " leading and trailing ")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user