mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #26544 -- Delayed translations of SetPasswordForm help_texts
Thanks Michael Bitzi for the reporti and Tim Graham for the review.
This commit is contained in:
parent
deeffde84a
commit
b26fedacef
3 changed files with 25 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
|
@ -350,6 +351,23 @@ class SetPasswordFormTest(TestDataMixin, TestCase):
|
|||
self.assertEqual(form.cleaned_data['new_password1'], data['new_password1'])
|
||||
self.assertEqual(form.cleaned_data['new_password2'], data['new_password2'])
|
||||
|
||||
@override_settings(AUTH_PASSWORD_VALIDATORS=[
|
||||
{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'},
|
||||
{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 'OPTIONS': {
|
||||
'min_length': 12,
|
||||
}},
|
||||
])
|
||||
def test_help_text_translation(self):
|
||||
french_help_texts = [
|
||||
'Votre mot de passe ne peut pas trop ressembler à vos autres informations personnelles.',
|
||||
'Votre mot de passe doit contenir au minimum 12 caractères.',
|
||||
]
|
||||
form = SetPasswordForm(self.u1)
|
||||
with translation.override('fr'):
|
||||
html = form.as_p()
|
||||
for french_text in french_help_texts:
|
||||
self.assertIn(french_text, html)
|
||||
|
||||
|
||||
class PasswordChangeFormTest(TestDataMixin, TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue