summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-04-19 12:59:30 -0400
committerTim Graham <timograham@gmail.com>2017-04-19 12:59:53 -0400
commitcf1e682c8c68d7187c34f46f2717b22f830d92a1 (patch)
tree9bd53b6aace19b14efc7ceeca0ee0503a9c99411 /tests/auth_tests
parentfd983bcb50a4fd610f6b9918bca6efa858eeffec (diff)
[1.11.x] Fixed #28097 -- Fixed layout of ReadOnlyPasswordHashWidget.
Backport of dff559ff83a6aac14de0bbca58101786edf4195f from master
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_forms.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index cc77288f56..4bfc3d11e7 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -834,6 +834,22 @@ class ReadOnlyPasswordHashTest(SimpleTestCase):
html = widget.render(name='password', value=None, attrs={})
self.assertIn(_("No password set."), html)
+ @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.PBKDF2PasswordHasher'])
+ def test_render(self):
+ widget = ReadOnlyPasswordHashWidget()
+ value = 'pbkdf2_sha256$100000$a6Pucb1qSFcD$WmCkn9Hqidj48NVe5x0FEM6A9YiOqQcl/83m2Z5udm0='
+ self.assertHTMLEqual(
+ widget.render('name', value, {'id': 'id_password'}),
+ """
+ <div id="id_password">
+ <strong>algorithm</strong>: pbkdf2_sha256
+ <strong>iterations</strong>: 100000
+ <strong>salt</strong>: a6Pucb******
+ <strong>hash</strong>: WmCkn9**************************************
+ </div>
+ """
+ )
+
def test_readonly_field_has_changed(self):
field = ReadOnlyPasswordHashField()
self.assertFalse(field.has_changed('aaa', 'bbb'))