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):
|
def test_password_changed(self):
|
||||||
self.assertIsNone(password_changed('password'))
|
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):
|
def test_password_validators_help_texts(self):
|
||||||
help_texts = password_validators_help_texts()
|
help_texts = password_validators_help_texts()
|
||||||
self.assertEqual(len(help_texts), 2)
|
self.assertEqual(len(help_texts), 2)
|
||||||
|
|
Loading…
Reference in New Issue