MCPcopy
hub / github.com/django/django / test_hide_change_password

Method test_hide_change_password

tests/admin_views/tests.py:1441–1459  ·  view source on GitHub ↗

Tests if the "change password" link in the admin is hidden if the User does not have a usable password set. (against 9bea85795705d015cdadc82c68b99196a8554f5c)

(self)

Source from the content-addressed store, hash-verified

1439 self.assertContains(response, 'data-popup-opener="%s"' % actor.pk)
1440
1441 def test_hide_change_password(self):
1442 """
1443 Tests if the "change password" link in the admin is hidden if the User
1444 does not have a usable password set.
1445 (against 9bea85795705d015cdadc82c68b99196a8554f5c)
1446 """
1447 user = User.objects.get(username="super")
1448 user.set_unusable_password()
1449 user.save()
1450 self.client.force_login(user)
1451 response = self.client.get(reverse("admin:index"))
1452 self.assertNotContains(
1453 response,
1454 reverse("admin:password_change"),
1455 msg_prefix=(
1456 'The "change password" link should not be displayed if a user does not '
1457 "have a usable password."
1458 ),
1459 )
1460
1461 def test_change_view_with_show_delete_extra_context(self):
1462 """

Callers

nothing calls this directly

Calls 6

reverseFunction · 0.90
set_unusable_passwordMethod · 0.80
force_loginMethod · 0.80
assertNotContainsMethod · 0.80
getMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected