277
277
def test_empty(self):
278
278
ie = InventoryDirectory('foo', 'foo', 'foo')
279
t = directory_to_tree(ie, None, {})
279
t = directory_to_tree(ie, None, {}, None)
280
280
self.assertEquals(None, t)
282
282
def test_empty_dir(self):
283
283
ie = InventoryDirectory('foo', 'foo', 'foo')
284
284
child_ie = InventoryDirectory('bar', 'bar', 'bar')
285
285
ie.children['bar'] = child_ie
286
t = directory_to_tree(ie, lambda x: None, {})
286
t = directory_to_tree(ie, lambda x: None, {}, None)
287
287
self.assertEquals(None, t)
289
def test_empty_dir_dummy_files(self):
290
ie = InventoryDirectory('foo', 'foo', 'foo')
291
child_ie = InventoryDirectory('bar', 'bar', 'bar')
292
ie.children['bar'] = child_ie
293
t = directory_to_tree(ie, lambda x: None, {}, ".mydummy")
294
self.assertTrue(".mydummy" in t)
289
296
def test_empty_root(self):
290
297
ie = InventoryDirectory('foo', 'foo', None)
291
298
child_ie = InventoryDirectory('bar', 'bar', 'bar')
292
299
ie.children['bar'] = child_ie
293
t = directory_to_tree(ie, lambda x: None, {})
300
t = directory_to_tree(ie, lambda x: None, {}, None)
294
301
self.assertEquals(Tree(), t)
296
303
def test_with_file(self):
298
305
child_ie = InventoryFile('bar', 'bar', 'bar')
299
306
ie.children['bar'] = child_ie
300
307
b = Blob.from_string("bla")
301
t1 = directory_to_tree(ie, lambda x: b.id, {})
308
t1 = directory_to_tree(ie, lambda x: b.id, {}, None)
303
310
t2.add(0100644, "bar", b.id)
304
311
self.assertEquals(t1, t2)