mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-04 15:20:22 +00:00
Adding tests for unselected actions.
This commit is contained in:
parent
35cb0bcc75
commit
bf21d8dac4
1 changed files with 37 additions and 0 deletions
|
|
@ -269,6 +269,43 @@ class PostListTest(BaseIntegrationTest):
|
|||
model_admin.ordering,
|
||||
)
|
||||
|
||||
def test_all_unselected_action(self):
|
||||
self._create_posts()
|
||||
|
||||
response = self.client.get(reverse("admin2:blog_post_index"))
|
||||
|
||||
self.assertTrue(all([
|
||||
not post.published
|
||||
for post in response.context["object_list"]
|
||||
]))
|
||||
|
||||
response = self.client.post(
|
||||
reverse("admin2:blog_post_index"),
|
||||
{
|
||||
'action': 'PublishAllItemsAction',
|
||||
},
|
||||
follow=True
|
||||
)
|
||||
|
||||
self.assertTrue(all([
|
||||
post.published
|
||||
for post in response.context["object_list"]
|
||||
]))
|
||||
|
||||
# Test function-based view
|
||||
response = self.client.post(
|
||||
reverse("admin2:blog_post_index"),
|
||||
{
|
||||
'action': 'PublishAllItemsAction',
|
||||
},
|
||||
follow=True,
|
||||
)
|
||||
|
||||
self.assertTrue(all([
|
||||
post.published
|
||||
for post in response.context["object_list"]
|
||||
]))
|
||||
|
||||
|
||||
class PostListTestCustomAction(BaseIntegrationTest):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue