mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Added a test for password_changed() with a custom validator.
This commit is contained in:
parent
553c24018e
commit
8624459586
@ -57,6 +57,18 @@ class PasswordValidationTest(TestCase):
|
||||
def test_password_changed(self):
|
||||
self.assertIsNone(password_changed('password'))
|
||||
|
||||
def test_password_changed_with_custom_validator(self):
|
||||
class Validator:
|
||||
def password_changed(self, password, user):
|
||||
self.password = password
|
||||
self.user = user
|
||||
|
||||
user = object()
|
||||
validator = Validator()
|
||||
password_changed('password', user=user, password_validators=(validator,))
|
||||
self.assertIs(validator.user, user)
|
||||
self.assertEqual(validator.password, 'password')
|
||||
|
||||
def test_password_validators_help_texts(self):
|
||||
help_texts = password_validators_help_texts()
|
||||
self.assertEqual(len(help_texts), 2)
|
||||
|
Loading…
Reference in New Issue
Block a user