Ejemplo n.º 1
0
 def test_build_tree(self):
     """Test building works using a MemoryTree."""
     branch = self.make_branch('branch')
     tree = MemoryTree.create_on_branch(branch)
     builder = TreeBuilder()
     builder.start_tree(tree)
     builder.build(['foo', "bar/", "bar/file"])
     self.assertEqual(b'contents of foo\n', tree.get_file('foo').read())
     self.assertEqual(b'contents of bar/file\n',
                      tree.get_file('bar/file').read())
     builder.finish_tree()
Ejemplo n.º 2
0
 def test_finish_tree_unlocks(self):
     builder = TreeBuilder()
     tree = FakeTree()
     builder.start_tree(tree)
     builder.finish_tree()
     self.assertEqual(["lock_tree_write", "unlock"], tree._calls)