def test_business_subpage(self): add_subpage_url = reverse('wagtailadmin_pages:add_subpage', args=(self.business_index.id, )) # explorer should contain a link to 'add child page' response = self.client.get(reverse('wagtailadmin_explore', args=(self.business_index.id, ))) self.assertEqual(response.status_code, 200) self.assertContains(response, add_subpage_url) # add_subpage should give us a cut-down set of page types to choose response = self.client.get(add_subpage_url) self.assertEqual(response.status_code, 200) self.assertNotContains(response, StandardIndex.get_verbose_name()) self.assertNotContains(response, StandardChild.get_verbose_name()) self.assertContains(response, BusinessSubIndex.get_verbose_name()) self.assertContains(response, BusinessChild.get_verbose_name())
def test_standard_subpage(self): add_subpage_url = reverse('wagtailadmin_pages:add_subpage', args=(self.standard_index.id, )) # explorer should contain a link to 'add child page' response = self.client.get(reverse('wagtailadmin_explore', args=(self.standard_index.id, ))) self.assertEqual(response.status_code, 200) self.assertContains(response, add_subpage_url) # add_subpage should give us choices of StandardChild, and BusinessIndex. # BusinessSubIndex and BusinessChild are not allowed response = self.client.get(add_subpage_url) self.assertEqual(response.status_code, 200) self.assertContains(response, StandardChild.get_verbose_name()) self.assertContains(response, BusinessIndex.get_verbose_name()) self.assertNotContains(response, BusinessSubIndex.get_verbose_name()) self.assertNotContains(response, BusinessChild.get_verbose_name())
def setUp(self): # Find root page self.root_page = Page.objects.get(id=2) # Add child page self.child_page = SimplePage( title="Hello world!", slug="hello-world", content="hello" ) self.root_page.add_child(instance=self.child_page) # Add a page with child pages of its own self.child_index = StandardIndex(title="Hello index", slug="hello-index") self.root_page.add_child(instance=self.child_index) self.grandchild_page = StandardChild(title="Hello Kitty", slug="hello-kitty") self.child_index.add_child(instance=self.grandchild_page) # Login self.user = self.login()