def test_can_move_to(self): self.assertTrue(SimplePage().can_move_to(SimplePage())) # StandardIndex should only be allowed under a Page self.assertTrue(StandardIndex().can_move_to(Page())) self.assertFalse(StandardIndex().can_move_to(SimplePage())) # The Business pages are quite restrictive in their structure self.assertTrue(BusinessSubIndex().can_move_to(BusinessIndex())) self.assertTrue(BusinessChild().can_move_to(BusinessIndex())) self.assertTrue(BusinessChild().can_move_to(BusinessSubIndex())) self.assertFalse(BusinessChild().can_move_to(SimplePage())) self.assertFalse(BusinessSubIndex().can_move_to(SimplePage()))
def setUp(self): # Find root page self.root_page = Page.objects.get(id=2) # Add standard page (allows subpages of any type) self.standard_index = StandardIndex() self.standard_index.title = "Standard Index" self.standard_index.slug = "standard-index" self.root_page.add_child(instance=self.standard_index) # Add business page (allows BusinessChild and BusinessSubIndex as subpages) self.business_index = BusinessIndex() self.business_index.title = "Business Index" self.business_index.slug = "business-index" self.root_page.add_child(instance=self.business_index) # Add business child (allows no subpages) self.business_child = BusinessChild() self.business_child.title = "Business Child" self.business_child.slug = "business-child" self.business_index.add_child(instance=self.business_child) # Add business subindex (allows only BusinessChild as subpages) self.business_subindex = BusinessSubIndex() self.business_subindex.title = "Business Subindex" self.business_subindex.slug = "business-subindex" self.business_index.add_child(instance=self.business_subindex) # Login self.login()
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) # more child pages to test ordering self.old_page = StandardIndex( title="Old page", slug="old-page", latest_revision_created_at=local_datetime(2010, 1, 1)) self.root_page.add_child(instance=self.old_page) self.new_page = SimplePage(title="New page", slug="new-page", content="hello", latest_revision_created_at=local_datetime( 2016, 1, 1)) self.root_page.add_child(instance=self.new_page) # Login self.user = self.login()
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()