Tested the admin's delete_selected action when it receives nonexistent pks.
This commit is contained in:
parent
ba37ee9ef8
commit
0fa6ab8c18
|
@ -61,6 +61,17 @@ class AdminActionsTest(TestCase):
|
||||||
self.client.post(reverse('admin:admin_views_subscriber_changelist'), delete_confirmation_data)
|
self.client.post(reverse('admin:admin_views_subscriber_changelist'), delete_confirmation_data)
|
||||||
self.assertEqual(Subscriber.objects.count(), 0)
|
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)
|
@override_settings(USE_THOUSAND_SEPARATOR=True, USE_L10N=True)
|
||||||
def test_non_localized_pk(self):
|
def test_non_localized_pk(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue