Exemple #1
0
    def test_hide_untranslated(self):
        TESTLANG = get_primary_lanaguage()
        TESTLANG2 = get_secondary_lanaguage()
        page = create_page("mlpage-%s" % TESTLANG, "nav_playground.html", TESTLANG)
        create_title(TESTLANG2, "mlpage-%s" % TESTLANG2, page, slug=page.get_slug())
        page2 = create_page("mlpage-2-%s" % TESTLANG, "nav_playground.html", TESTLANG, parent=page)
        page.publish(TESTLANG)
        page.publish(TESTLANG2)
        page2.publish(TESTLANG)

        menu = CMSMenu()
        lang_settings = copy.deepcopy(get_cms_setting('LANGUAGES'))

        request_1 = self.get_request('/%s/' % TESTLANG, TESTLANG)
        request_2 = self.get_request('/%s/' % TESTLANG2, TESTLANG2)

        lang_settings[1][1]['hide_untranslated'] = False
        with SettingsOverride(CMS_LANGUAGES=lang_settings):
            list_1 = [node.id for node in menu.get_nodes(request_1)]
            list_2 = [node.id for node in menu.get_nodes(request_2)]
            self.assertEqual(list_1, list_2)
            self.assertEqual(len(list_1), 2)

        lang_settings[1][1]['hide_untranslated'] = True
        with SettingsOverride(CMS_LANGUAGES=lang_settings):
            list_1 = [node.id for node in menu.get_nodes(request_1)]
            list_2 = [node.id for node in menu.get_nodes(request_2)]
            self.assertNotEqual(list_1, list_2)
            self.assertEqual(len(list_2), 1)
            self.assertEqual(len(list_1), 2)
Exemple #2
0
    def test_hide_untranslated(self):
        TESTLANG = get_primary_lanaguage()
        TESTLANG2 = get_secondary_lanaguage()
        page = create_page("mlpage-%s" % TESTLANG, "nav_playground.html", TESTLANG)
        create_title(TESTLANG2, "mlpage-%s" % TESTLANG2, page, slug=page.get_slug())
        page2 = create_page("mlpage-2-%s" % TESTLANG, "nav_playground.html", TESTLANG, parent=page)
        page.publish(TESTLANG)
        page.publish(TESTLANG2)
        page2.publish(TESTLANG)

        menu = CMSMenu()
        lang_settings = copy.deepcopy(get_cms_setting('LANGUAGES'))

        request_1 = self.get_request('/%s/' % TESTLANG, TESTLANG)
        request_2 = self.get_request('/%s/' % TESTLANG2, TESTLANG2)

        lang_settings[1][1]['hide_untranslated'] = False
        with self.settings(CMS_LANGUAGES=lang_settings):
            list_1 = [node.id for node in menu.get_nodes(request_1)]
            list_2 = [node.id for node in menu.get_nodes(request_2)]
            self.assertEqual(list_1, list_2)
            self.assertEqual(len(list_1), 2)

        lang_settings[1][1]['hide_untranslated'] = True
        with self.settings(CMS_LANGUAGES=lang_settings):
            list_1 = [node.id for node in menu.get_nodes(request_1)]
            list_2 = [node.id for node in menu.get_nodes(request_2)]
            self.assertNotEqual(list_1, list_2)
            self.assertEqual(len(list_2), 1)
            self.assertEqual(len(list_1), 2)
Exemple #3
0
 def test_01_basic_cms_menu(self):
     self.assertEqual(len(menu_pool.menus), 1)
     response = self.client.get(self.get_pages_root()) # path = '/'
     self.assertEquals(response.status_code, 200)
     request = self.get_request()
     
     # test the cms menu class
     menu = CMSMenu()
     nodes = menu.get_nodes(request)
     self.assertEqual(len(nodes), len(self.get_all_pages()))
Exemple #4
0
 def test_basic_cms_menu(self):
     self.assertEqual(len(menu_pool.menus), 1)
     response = self.client.get(self.get_pages_root()) # path = '/'
     self.assertEquals(response.status_code, 200)
     request = self.get_request()
     
     # test the cms menu class
     menu = CMSMenu()
     nodes = menu.get_nodes(request)
     self.assertEqual(len(nodes), len(self.get_all_pages()))
Exemple #5
0
 def test_01_basic_cms_menu(self):
     self.assertEqual(len(menu_pool.menus), 1)
     response = self.client.get("/")
     self.assertEquals(response.status_code, 200)
     request = self.get_request()
     
     # test the cms menu class
     menu = CMSMenu()
     nodes = menu.get_nodes(request)
     self.assertEqual(len(nodes), 5)