Added some tests.

This commit is contained in:
Kevin Diale 2013-07-30 10:05:57 -04:00
parent 6ff47746df
commit eb204104bd
2 changed files with 12 additions and 0 deletions

View file

@ -41,6 +41,7 @@ class CommentAdmin(djadmin2.ModelAdmin2):
list_filter = ['post', ]
actions_on_top = True
actions_on_bottom = True
actions_selection_counter = False
# Register each model with the admin

View file

@ -51,6 +51,12 @@ class CommentListTest(BaseIntegrationTest):
self.assertContains(response, "comment_post_1_b")
self.assertNotContains(response, "comment_post_2")
def test_list_selected_hides(self):
post_1 = Post.objects.create(title="post_1_title", body="body")
Comment.objects.create(body="comment_post1_body", post=post_1)
response = self.client.get(reverse("admin2:blog_comment_index"))
self.assertNotContains(response, "of 1 selected")
class PostListTest(BaseIntegrationTest):
def test_view_ok(self):
@ -64,6 +70,11 @@ class PostListTest(BaseIntegrationTest):
response = self.client.get(reverse("admin2:blog_post_index"))
self.assertContains(response, 'id="list_filter_container"')
def test_list_selected_shows(self):
Post.objects.create(title="post_1_title", body="body")
response = self.client.get(reverse("admin2:blog_post_index"))
self.assertContains(response, 'class="selected-count"')
def test_actions_displayed(self):
response = self.client.get(reverse("admin2:blog_post_index"))
self.assertInHTML('<a tabindex="-1" href="#" data-name="action" data-value="DeleteSelectedAction">Delete selected items</a>', response.content)