Permalink
Browse files

Added assertion for admin change form's "save and continue editing" m…

…essage.
  • Loading branch information...
timgraham committed May 14, 2018
1 parent 0a8a6b4 commit 49a1736c2eb4a75b4eadc52f6cf9abc92f0f3bdf
Showing with 10 additions and 1 deletion.
  1. +10 −1 tests/admin_views/tests.py
View
@@ -4755,9 +4755,18 @@ def test_save_continue_editing_button(self):
'_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'), {

0 comments on commit 49a1736

Please sign in to comment.