/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tests/test_mapping.py

Merge changes to avoid inventories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
    def test_escape_space(self):
72
72
        self.assertEquals("bla_s", escape_file_id("bla "))
73
73
 
 
74
    def test_escape_control_l(self):
 
75
        self.assertEquals("bla_c", escape_file_id("bla\x0c"))
 
76
 
 
77
    def test_unescape_control_l(self):
 
78
        self.assertEquals("bla\x0c", unescape_file_id("bla_c"))
 
79
 
74
80
    def test_escape_underscore(self):
75
81
        self.assertEquals("bla__", escape_file_id("bla_"))
76
82
 
305
311
class DirectoryToTreeTests(tests.TestCase):
306
312
 
307
313
    def test_empty(self):
308
 
        ie = InventoryDirectory('foo', 'foo', 'foo')
309
 
        t = directory_to_tree(ie, None, {}, None)
 
314
        t = directory_to_tree({}, None, {}, None, allow_empty=False)
310
315
        self.assertEquals(None, t)
311
316
 
312
317
    def test_empty_dir(self):
313
 
        ie = InventoryDirectory('foo', 'foo', 'foo')
314
318
        child_ie = InventoryDirectory('bar', 'bar', 'bar')
315
 
        ie.children['bar'] = child_ie
316
 
        t = directory_to_tree(ie, lambda x: None, {}, None)
 
319
        children = {'bar': child_ie}
 
320
        t = directory_to_tree(children, lambda x: None, {}, None,
 
321
                allow_empty=False)
317
322
        self.assertEquals(None, t)
318
323
 
319
324
    def test_empty_dir_dummy_files(self):
320
 
        ie = InventoryDirectory('foo', 'foo', 'foo')
321
325
        child_ie = InventoryDirectory('bar', 'bar', 'bar')
322
 
        ie.children['bar'] = child_ie
323
 
        t = directory_to_tree(ie, lambda x: None, {}, ".mydummy")
 
326
        children = {'bar':child_ie}
 
327
        t = directory_to_tree(children, lambda x: None, {}, ".mydummy",
 
328
                allow_empty=False)
324
329
        self.assertTrue(".mydummy" in t)
325
330
 
326
331
    def test_empty_root(self):
327
 
        ie = InventoryDirectory('foo', 'foo', None)
328
332
        child_ie = InventoryDirectory('bar', 'bar', 'bar')
329
 
        ie.children['bar'] = child_ie
330
 
        t = directory_to_tree(ie, lambda x: None, {}, None)
 
333
        children = {'bar': child_ie}
 
334
        t = directory_to_tree(children, lambda x: None, {}, None,
 
335
                allow_empty=True)
331
336
        self.assertEquals(Tree(), t)
332
337
 
333
338
    def test_with_file(self):
334
 
        ie = InventoryDirectory('foo', 'foo', 'foo')
335
339
        child_ie = InventoryFile('bar', 'bar', 'bar')
336
 
        ie.children['bar'] = child_ie
 
340
        children = {"bar": child_ie}
337
341
        b = Blob.from_string("bla")
338
 
        t1 = directory_to_tree(ie, lambda x: b.id, {}, None)
 
342
        t1 = directory_to_tree(children, lambda x: b.id, {}, None,
 
343
                allow_empty=False)
339
344
        t2 = Tree()
340
 
        t2.add(0100644, "bar", b.id)
 
345
        t2.add("bar", 0100644, b.id)
341
346
        self.assertEquals(t1, t2)