def test_include_content_types(self): root = get_root() set_nav_setting('left', 'display_type', 'tree') set_nav_setting('left', 'options', ['stacked', 'include_root']) root[u'content_1'] = Content() root[u'content_2'] = Content() root[u'content_2'].in_navigation = False # If we include the content type the nav item is present. set_nav_setting('left', 'include', [Content.type_info.name]) html = render_view(root, self.request, name='navigation-widget-tree') assert u'content_1' in html assert u'content_2' not in html # With an empty include_content_types, the nav item is not present. set_nav_setting('left', 'include', []) html = render_view(root, self.request, name='navigation-widget-tree') assert u'content_1' in html assert u'content_2' not in html # Again, with show_hidden True. set_nav_setting('left', 'options', ['stacked', 'include_root', 'show_hidden_while_logged_in']) with patch('kotti_navigation.util.the_user', return_value='admin'): html = render_view(root, self.request, name='navigation-widget-tree') assert u'content_1' in html assert u'content_2' in html
def test_show_hidden(self): root = get_root() request = DummyRequest() root[u'content_1'] = Content() root[u'content_2'] = Content() root[u'content_2'].in_navigation = False # with standard settings the hidden nav points are hidden html = render_view(root, request, name='navigation-widget') assert u'content_1' in html assert u'content_2' not in html # if we change the setting, the nav points still hidden get_current_registry().settings['kotti_navigation.navigation_widget.show_hidden_while_logged_in'] = u'true' html = render_view(root, request, name='navigation-widget') assert u'content_1' in html assert u'content_2' not in html
def test_include_content_types(self): root = get_root() request = NavigationDummyRequest(path='/some-navigation-widget-left') root[u'content_1'] = Content() root[u'content_2'] = Content() root[u'content_2'].in_navigation = False # If we include the content type the nav item is present. se = get_current_registry().settings se['kotti_navigation.navigation_widget.left_include_content_types'] =\ u'kotti.resources.Content' html = render_view(root, request, name='navigation-widget-tree-left') assert u'content_1' in html # With an empty include_content_types, the nav item is not present. se['kotti_navigation.navigation_widget.left_include_content_types'] =\ u'' html = render_view(root, request, name='navigation-widget-tree-left') assert u'content_1' in html
def test_show_hidden(self): root = get_root() request = NavigationDummyRequest(path='/some-navigation-widget-left') root[u'content_1'] = Content() root[u'content_2'] = Content() root[u'content_2'].in_navigation = False # with standard settings the hidden nav items are hidden html = render_view(root, request, name='navigation-widget-tree-left') assert u'content_1' in html assert u'content_2' not in html # if we change the setting, the nav items still hidden se = get_current_registry().settings se['kotti_navigation.navigation_widget.left_show_hidden_while_logged_in'] =\ u'true' html = render_view(root, request, name='navigation-widget-tree-left') assert u'content_1' in html assert u'content_2' not in html
def test_include_content_types(self): root = get_root() request = NavigationDummyRequest(path='/some-navigation-widget-left') root[u'content_1'] = Content() root[u'content_2'] = Content() root[u'content_2'].in_navigation = False # If we include the content type the nav item is present. se = get_current_registry().settings se['kotti_navigation.navigation_widget.left_include_content_types'] =\ u'kotti.resources.Content' html = render_view(root, request, name='navigation-widget-tree-left') assert u'content_1' in html # With an empty include_content_types, the nav item is not present. se['kotti_navigation.navigation_widget.left_include_content_types'] =\ u'' html = render_view(root, request, name='navigation-widget-tree-left') assert u'content_1' in html
def test_show_hidden(self): root = get_root() request = NavigationDummyRequest(path='/some-navigation-widget-left') root[u'content_1'] = Content() root[u'content_2'] = Content() root[u'content_2'].in_navigation = False # with standard settings the hidden nav items are hidden html = render_view(root, request, name='navigation-widget-tree-left') assert u'content_1' in html assert u'content_2' not in html # if we change the setting, the nav items still hidden se = get_current_registry().settings se['kotti_navigation.navigation_widget.left_show_hidden_while_logged_in'] =\ u'true' html = render_view(root, request, name='navigation-widget-tree-left') assert u'content_1' in html assert u'content_2' not in html
def test_show_hidden(self): root = get_root() set_nav_setting('left', 'display_type', 'tree') set_nav_setting('left', 'options', ['stacked', 'include_root']) root[u'content_1'] = Content() root[u'content_2'] = Content() root[u'content_2'].in_navigation = False # with standard settings the hidden nav items are hidden html = render_view(root, self.request, name='navigation-widget-tree') assert u'content_1' in html assert u'content_2' not in html # if we change the setting, the nav items still hidden set_nav_setting('left', 'options', ['tabs', 'stacked', 'include_root', 'show_hidden_while_logged_in']) with patch('kotti_navigation.util.the_user', return_value='admin'): html = render_view(root, self.request, name='navigation-widget-tree') assert u'content_1' in html assert u'content_2' in html