def test_allowed_parent_page_models(self): # SimplePage does not define any restrictions on parent page types # SimplePage is a valid parent page of SimplePage self.assertIn(SimplePage, SimplePage.allowed_parent_page_models()) # BusinessChild cannot be a parent of anything self.assertNotIn(BusinessChild, SimplePage.allowed_parent_page_models()) # BusinessNowherePage does not allow anything as a parent self.assertNotIn(SimplePage, BusinessNowherePage.allowed_parent_page_models()) self.assertNotIn(StandardIndex, BusinessNowherePage.allowed_parent_page_models()) # BusinessSubIndex only allows BusinessIndex as a parent self.assertNotIn(SimplePage, BusinessSubIndex.allowed_parent_page_models()) self.assertIn(BusinessIndex, BusinessSubIndex.allowed_parent_page_models())
def test_allowed_parent_page_types(self): """ Same assertions as for test_allowed_parent_page_models - allowed_parent_page_types should mirror allowed_parent_page_models with ContentType objects rather than model classes """ with self.ignore_deprecation_warnings(): # SimplePage does not define any restrictions on parent page types # SimplePage is a valid parent page of SimplePage self.assertIn(get_ct(SimplePage), SimplePage.allowed_parent_page_types()) # BusinessChild cannot be a parent of anything self.assertNotIn(get_ct(BusinessChild), SimplePage.allowed_parent_page_types()) # BusinessNowherePage does not allow anything as a parent self.assertNotIn(get_ct(SimplePage), BusinessNowherePage.allowed_parent_page_types()) self.assertNotIn(get_ct(StandardIndex), BusinessNowherePage.allowed_parent_page_types()) # BusinessSubIndex only allows BusinessIndex as a parent self.assertNotIn(get_ct(SimplePage), BusinessSubIndex.allowed_parent_page_types()) self.assertIn(get_ct(BusinessIndex), BusinessSubIndex.allowed_parent_page_types())