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, '', html=True) + @override_settings(USE_THOUSAND_SEPARATOR=True, USE_L10N=True) def test_non_localized_pk(self): """