summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2012-04-29 09:08:12 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2012-04-29 09:08:12 -0700
commite75bd7e51cd6fe1f02fcdb438d58770917116c8f (patch)
treef9e0e2d705c0d0052e659ea5cf62df6322ad0edc
parenta15cfb2e451feb626d141461eb058ff760bed913 (diff)
parent0525f6d8bdd8cf1aafaac40c4325aceb49b3c6f8 (diff)
Merge pull request #22 from aviraldg/test_17967
Added regression test for #17967. Thanks to aviraldg for the patch!
-rw-r--r--tests/regressiontests/admin_views/tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 55a2639028..0be8b36b27 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -572,6 +572,21 @@ class AdminViewBasicTest(TestCase):
except SuspiciousOperation:
self.fail("Filters should be allowed if they are defined on a ForeignKey pointing to this model")
+ def test_hide_change_password(self):
+ """
+ Tests if the "change password" link in the admin is hidden if the User
+ does not have a usable password set.
+ (against 9bea85795705d015cdadc82c68b99196a8554f5c)
+ """
+ user = User.objects.get(username='super')
+ password = user.password
+ user.set_unusable_password()
+ user.save()
+
+ response = self.client.get('/test_admin/admin/')
+ self.assertFalse(reverse('admin:password_change') in response.content,
+ msg='The "change password" link should not be displayed if a user does not have a usable password.')
+
class AdminViewFormUrlTest(TestCase):
urls = "regressiontests.admin_views.urls"