Commits

Alexis Petrounias committed dafaa79

Coverage test case for custom position callback in CTENode.move.

Comments (0)

Files changed (1)

cte_tree_test/tests.py

         self.assertEqual(NoneDeleteNode.objects.get().id, root_node.id)
         
         
+    def test_node_move(self):
+        
+        root_node = SimpleNode.objects.create()
+        middle_node = SimpleNode.objects.create(parent = root_node)
+        bottom_node_1 = SimpleNode.objects.create(parent = middle_node)
+        bottom_node_2 = SimpleNode.objects.create(parent = middle_node)
+        bottom_node_3 = SimpleNode.objects.create(parent = middle_node)
+        
+        fresh_bottom_node_3 = SimpleNode.objects.get(id = bottom_node_3.id)
+        
+        self.assertEqual(fresh_bottom_node_3.depth, 3)
+        
+        bottom_node_3.move(root_node, position = lambda node, destination: None,
+            save = True)
+        
+        fresh_bottom_node_3 = SimpleNode.objects.get(id = bottom_node_3.id)
+        
+        self.assertEqual(fresh_bottom_node_3.depth, 2)
+        
+        
 class SimpleNodeErrorsTest(TestCase):
     
     def test_node_parameters_parent_1(self):