test that add button is present only if page allows subpages

This commit is contained in:
Eric Drechsel 2014-11-21 13:24:29 -08:00 committed by Karl Hobley
parent a5940bef98
commit 805e078556

View file

@ -78,18 +78,18 @@ class TestUserbarAddLink(TestCase, WagtailTestUtils):
def test_page_allowing_subpages(self):
response = self.client.get(reverse('wagtailadmin_userbar_frontend', args=(self.event_index.id, )))
# page allows subpages, so the 'add page' button should add a subpage
# page allows subpages, so the 'add page' button should show
expected_url = reverse('wagtailadmin_pages_add_subpage', args=(self.event_index.id, ))
expected_link = '<a href="%s" target="_parent" class="action icon icon-plus" title="Add a child page">Add</a>' % expected_url
self.assertContains(response, expected_link)
def test_page_disallowing_subpages(self):
response = self.client.get(reverse('wagtailadmin_userbar_frontend', args=(self.business_child.id, )))
print response
# page disallows subpages, so the 'add page' button should add a page at the same level
# page disallows subpages, so the 'add page' button shouldn't show
expected_url = reverse('wagtailadmin_pages_add_subpage', args=(self.business_index.id, ))
expected_link = '<a href="%s" target="_parent" class="action icon icon-plus" title="Add another page at this level">Add</a>' % expected_url
self.assertContains(response, expected_link)
expected_link = '<a href="%s" target="_parent" class="action icon icon-plus" title="Add a child page">Add</a>' % expected_url
self.assertNotContains(response, expected_link)
class TestUserbarModeration(TestCase, WagtailTestUtils):