Added assertion for admin change form's "save and continue editing" message.

This commit is contained in:
Tim Graham 2018-05-14 09:33:35 -04:00
parent 0a8a6b4683
commit 49a1736c2e
1 changed files with 10 additions and 1 deletions

View File

@ -4755,9 +4755,18 @@ class UserAdminTest(TestCase):
'_continue': '1',
})
new_user = User.objects.get(username='newuser')
self.assertRedirects(response, reverse('admin:auth_user_change', args=(new_user.pk,)))
new_user_url = reverse('admin:auth_user_change', args=(new_user.pk,))
self.assertRedirects(response, new_user_url, fetch_redirect_response=False)
self.assertEqual(User.objects.count(), user_count + 1)
self.assertTrue(new_user.has_usable_password())
response = self.client.get(new_user_url)
self.assertContains(
response,
'<li class="success">The user "<a href="%s">'
'%s</a>" was added successfully. You may edit it again below.</li>'
% (new_user_url, new_user),
html=True,
)
def test_password_mismatch(self):
response = self.client.post(reverse('admin:auth_user_add'), {