Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added test for menus.utils.find_selected

  • Loading branch information...
commit 198e1045b556ee3ced3e91f6a0fbec00e67cf5d7 1 parent 035cb53
@ojii ojii authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 cms/tests/menu.py
View
12 cms/tests/menu.py
@@ -7,7 +7,7 @@
from django.template import Template
from menus.base import NavigationNode
from menus.menu_pool import menu_pool, _build_nodes_inner_for_one_menu
-from menus.utils import mark_descendants
+from menus.utils import mark_descendants, find_selected
class MenusTestCase(CMSTestCase):
@@ -18,7 +18,7 @@ def _get_nodes(self):
node4 = NavigationNode('4', '/4/', 4, 2)
node5 = NavigationNode('5', '/5/', 5)
nodes = [node1, node2, node3, node4, node5]
- tree = _build_nodes_inner_for_one_menu(nodes, "test")
+ tree = _build_nodes_inner_for_one_menu([n for n in nodes], "test")
return tree, nodes
def setUp(self):
@@ -481,4 +481,10 @@ def test_23_utils_mark_descendants(self):
tree_nodes, flat_nodes = self._get_nodes()
mark_descendants(tree_nodes)
for node in flat_nodes:
- self.assertTrue(node.descendant, node)
+ self.assertTrue(node.descendant, node)
+
+ def test_24_utils_find_selected(self):
+ tree_nodes, flat_nodes = self._get_nodes()
+ flat_nodes[3].selected = True
+ selected = find_selected(tree_nodes)
+ self.assertEqual(selected, flat_nodes[3])
Please sign in to comment.
Something went wrong with that request. Please try again.