diff options
| author | Karen Tracey <kmtracey@gmail.com> | 2009-12-12 21:51:47 +0000 |
|---|---|---|
| committer | Karen Tracey <kmtracey@gmail.com> | 2009-12-12 21:51:47 +0000 |
| commit | 8a59084c3a34db9b55c1ef426916f758185b9e29 (patch) | |
| tree | 5492ea6308b3240630bd0d994c71ae974fcf400a /tests/regressiontests/admin_views | |
| parent | 627f4623b747d3d0b57c3c09677f3d9a0cc39b05 (diff) | |
Fixed #12218: Added some helpful messages when Go is pressed in admin actions and there
is nothing to do because no action was selected or no items are selected.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11837 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views')
| -rw-r--r-- | tests/regressiontests/admin_views/tests.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index 167498ac37..3124071503 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -1157,7 +1157,6 @@ class AdminActionsTest(TestCase): self.assert_('action-checkbox-column' in response.content, "Expected an action-checkbox-column in response") - def test_multiple_actions_form(self): """ Test that actions come from the form whose submit button was pressed (#10618). @@ -1175,6 +1174,35 @@ class AdminActionsTest(TestCase): self.assertEquals(len(mail.outbox), 1) self.assertEquals(mail.outbox[0].subject, 'Greetings from a function action') + def test_user_message_on_none_selected(self): + """ + User should see a warning when 'Go' is pressed and no items are selected. + """ + action_data = { + ACTION_CHECKBOX_NAME: [], + 'action' : 'delete_selected', + 'index': 0, + } + response = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data) + msg = """Items must be selected in order to perform actions on them. No items have been changed.""" + self.assertContains(response, msg) + self.failUnlessEqual(Subscriber.objects.count(), 2) + + def test_user_message_on_no_action(self): + """ + User should see a warning when 'Go' is pressed and no action is selected. + """ + action_data = { + ACTION_CHECKBOX_NAME: [1, 2], + 'action' : '', + 'index': 0, + } + response = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data) + msg = """No action selected.""" + self.assertContains(response, msg) + self.failUnlessEqual(Subscriber.objects.count(), 2) + + class TestInlineNotEditable(TestCase): fixtures = ['admin-views-users.xml'] |
