summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_forms.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-05-06 12:23:52 +0200
committerClaude Paroz <claude@2xlibre.net>2016-05-07 10:17:49 +0200
commitb26fedacef16cc42a4fdd891af06ca925d4bb418 (patch)
tree62437684fc176121d69c7bb172bf9db455951781 /tests/auth_tests/test_forms.py
parentdeeffde84a23660e3dd589abaaa7454f4ee45fda (diff)
Fixed #26544 -- Delayed translations of SetPasswordForm help_texts
Thanks Michael Bitzi for the reporti and Tim Graham for the review.
Diffstat (limited to 'tests/auth_tests/test_forms.py')
-rw-r--r--tests/auth_tests/test_forms.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index ac23c2e96a..d77c9a976b 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -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):