Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added regression test for #17967.

  • Loading branch information...
commit d12d55ec26f127a09d9c133dd61dceaad2282b0e 1 parent 7c27d15
@aviraldg aviraldg authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/regressiontests/admin_views/tests.py
View
18 tests/regressiontests/admin_views/tests.py
@@ -572,6 +572,24 @@ def test_allowed_filtering_15103(self):
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/')
+ if reverse('admin:password_change') in response.content:
+ self.fail('The "change password" link should not be displayed if a user does not have a usable password.')
+
+ user.password = password
+ user.save()
+
class AdminViewFormUrlTest(TestCase):
urls = "regressiontests.admin_views.urls"
Please sign in to comment.
Something went wrong with that request. Please try again.