def test_build_children(self): layout = BaseLayout(request=mock_data.mock_request, request_kwargs=None, page=mock_page) children = layout._build_children() self.assertIn('page', children, 'children does not contain a main menu item') self.assertIn(MenuTypes.MAIN, children, 'children does not contain a main menu item') self.assertIn(MenuTypes.SIDE, children, 'children does not contain a side menu item') self.assertIsInstance(children['page'], BasePage, 'main menu is not a page object') self.assertIsInstance(children[MenuTypes.MAIN], MenuPagelet, 'main menu is not a menu pagelet') self.assertIsInstance(children[MenuTypes.SIDE], MenuPagelet, 'side menu is not a menu pagelet')
def test_build_children_no_page(self): layout = BaseLayout(request=None, request_kwargs=None, page=None) children = layout._build_children() self.assertDictEqual(children, {}, 'children is not an empty dictionary')