コード例 #1
0
ファイル: menu.py プロジェクト: AdrianRibao/django-cms
 def test_05_utils_find_selected(self):
     tree_nodes, flat_nodes = self._get_nodes()
     node = flat_nodes[0]
     selected = find_selected(tree_nodes)
     self.assertEqual(selected, node)
     selected = find_selected([])
     self.assertEqual(selected, None)
コード例 #2
0
ファイル: menu.py プロジェクト: zhiqunq/django-cms
 def test_utils_find_selected(self):
     tree_nodes, flat_nodes = self._get_nodes()
     node = flat_nodes[0]
     selected = find_selected(tree_nodes)
     self.assertEqual(selected, node)
     selected = find_selected([])
     self.assertEqual(selected, None)
コード例 #3
0
ファイル: menu.py プロジェクト: CreativeCubes/django-cms
 def test_24_utils_find_selected(self):
     with SettingsOverride(CMS_MODERATOR=False):    
         tree_nodes, flat_nodes = self._get_nodes()
         node = flat_nodes[0]
         selected = find_selected(tree_nodes)
         self.assertEqual(selected, node)
         selected = find_selected([])
         self.assertEqual(selected, None)
コード例 #4
0
 def test_find_selected(self):
     subchild = AttributeObject()
     firstchild = AttributeObject(ancestor=True, children=[subchild])
     selectedchild = AttributeObject(selected=True)
     secondchild = AttributeObject(ancestor=True, children=[selectedchild])
     root = AttributeObject(ancestor=True, children=[firstchild, secondchild])
     nodes = [root]
     selected = find_selected(nodes)
     self.assertEqual(selected, selectedchild)