Tests if the "change password" link in the admin is hidden if the User does not have a usable password set. (against 9bea85795705d015cdadc82c68b99196a8554f5c)
(self)
| 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 | """ |
nothing calls this directly
no test coverage detected