'Anonymous user should only see the pages in the rendered menu
that have no permissions assigned,directly or indirectly'

def test_public_menu_anonymous_user(self):

    self._setup_user_groups()
    all_pages = self._setup_tree_pages()
    self._setup_view_restrictions()
    granted = ['page_a', 'page_c', 'page_c_a', 'page_c_b', 'page_d_a', 'page_d_b', 'page_d_c', 'page_d_d']
    self.assertGrantedVisibility(all_pages, granted)
    urls = self.get_url_dict(all_pages)
    user = AnonymousUser()
    request = self.get_request(user, urls['/en/'])
    menu_renderer = menu_pool.get_renderer(request)
    nodes = menu_renderer.get_nodes()
    self.assertEqual(len(nodes), 4)
    self.assertInMenu(urls['/en/'], user)
    self.assertInMenu(urls['/en/page_c/'], user)
    self.assertInMenu(urls['/en/page_c/page_c_a/'], user)
    self.assertInMenu(urls['/en/page_c/page_c_b/'], user)
    self.assertViewNotAllowed(urls['/en/page_b/'], user)
    self.assertNotInMenu(urls['/en/page_b/'], user)
    self.assertViewNotAllowed(urls['/en/page_d/'], user)
    self.assertNotInMenu(urls['/en/page_d/'], user)
