diff options
| author | Becky Smith <rebkwok@gmail.com> | 2017-03-30 10:13:15 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-02-24 20:41:43 -0500 |
| commit | 8116e588dbdd17171a322da589b691bdf01f7041 (patch) | |
| tree | c46f319b831339ec9ee665e850f89bc3f3a169e0 /tests/admin_views/test_actions.py | |
| parent | 9822d88ca0dd855a668f9c33447aeac45a9768ac (diff) | |
Fixed #17962 -- Added ModelAdmin.get_deleted_objects().
Diffstat (limited to 'tests/admin_views/test_actions.py')
| -rw-r--r-- | tests/admin_views/test_actions.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/admin_views/test_actions.py b/tests/admin_views/test_actions.py index 4823316e3e..423c2f927f 100644 --- a/tests/admin_views/test_actions.py +++ b/tests/admin_views/test_actions.py @@ -12,7 +12,7 @@ from django.urls import reverse from .admin import SubscriberAdmin from .forms import MediaActionForm from .models import ( - Actor, Answer, ExternalSubscriber, Question, Subscriber, + Actor, Answer, Book, ExternalSubscriber, Question, Subscriber, UnchangeableObject, ) @@ -153,6 +153,18 @@ class AdminActionsTest(TestCase): self.assertIs(SubscriberAdmin.overridden, True) self.assertEqual(Subscriber.objects.all().count(), 0) + def test_delete_selected_uses_get_deleted_objects(self): + """The delete_selected action uses ModelAdmin.get_deleted_objects().""" + book = Book.objects.create(name='Test Book') + data = { + ACTION_CHECKBOX_NAME: [book.pk], + 'action': 'delete_selected', + 'index': 0, + } + response = self.client.post(reverse('admin2:admin_views_book_changelist'), data) + # BookAdmin.get_deleted_objects() returns custom text. + self.assertContains(response, 'a deletable object') + def test_custom_function_mail_action(self): """A custom action may be defined in a function.""" action_data = { |
