summaryrefslogtreecommitdiff
path: root/tests/admin_views
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-02-23 13:12:09 -0500
committerTim Graham <timograham@gmail.com>2018-02-24 09:21:13 -0500
commit0fa6ab8c181879fdce4a122691be88e897ba564d (patch)
tree8b3e1c5931e284d49f74a4ae8407ca888c9723da /tests/admin_views
parentba37ee9ef882deb8e917f1cae0c586a0a275e731 (diff)
Tested the admin's delete_selected action when it receives nonexistent pks.
Diffstat (limited to 'tests/admin_views')
-rw-r--r--tests/admin_views/test_actions.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/admin_views/test_actions.py b/tests/admin_views/test_actions.py
index b77714b32d..4823316e3e 100644
--- a/tests/admin_views/test_actions.py
+++ b/tests/admin_views/test_actions.py
@@ -61,6 +61,17 @@ class AdminActionsTest(TestCase):
self.client.post(reverse('admin:admin_views_subscriber_changelist'), delete_confirmation_data)
self.assertEqual(Subscriber.objects.count(), 0)
+ def test_default_delete_action_nonexistent_pk(self):
+ self.assertFalse(Subscriber.objects.filter(id=9998).exists())
+ action_data = {
+ ACTION_CHECKBOX_NAME: ['9998'],
+ 'action': 'delete_selected',
+ 'index': 0,
+ }
+ response = self.client.post(reverse('admin:admin_views_subscriber_changelist'), action_data)
+ self.assertContains(response, 'Are you sure you want to delete the selected subscribers?')
+ self.assertContains(response, '<ul></ul>', html=True)
+
@override_settings(USE_THOUSAND_SEPARATOR=True, USE_L10N=True)
def test_non_localized_pk(self):
"""