Пример #1
0
 def test_create_rename_delete(self):
     tree = Tree(alias='mytree')
     tree.save(force_insert=True)
     self.assertIsNotNone(tree.id)
     self.assertEqual(tree.alias, 'mytree')
     tree.alias = 'not_mytree'
     tree.save(force_update=True)
     self.assertEqual(tree.alias, 'not_mytree')
     tree.delete()
     self.assertIsNone(tree.id)
Пример #2
0
 def test_create_rename_delete(self):
     tree = Tree(alias='mytree')
     tree.save(force_insert=True)
     self.assertIsNotNone(tree.id)
     self.assertEqual(tree.alias, 'mytree')
     tree.alias = 'not_mytree'
     tree.save(force_update=True)
     self.assertEqual(tree.alias, 'not_mytree')
     tree.delete()
     self.assertIsNone(tree.id)
Пример #3
0
    def test_no_recursive_parents(self):
        """Verify that treeitems cannot be their own parent."""
        tree = Tree(alias="mytree")
        tree.save()
        tree_item = TreeItem(title="i'm my own grandpa", tree=tree)
        # This item needs to be saved, otherwise it cannot be set
        # as a parent.
        tree_item.save()

        tree_item.parent = tree_item
        tree_item.save()
        self.assertNotEqual(tree_item, tree_item.parent)