def test_subdir(self): "Test Dir managing a subdir" parent = Dir(u'.', u'/', u'fake://fake/repo/base') child = Dir(u'./test', u'test', u'fake://fake/repo/base') child.parent = parent self.s.add(child) self.s.add(parent) self.s.commit() ok_(len(parent.subdirs) == 1) eq_(parent.subdirs[0], child)
def test_repr(self): "Test Dir repr is as expected" parent = Dir(u'.', u'/', u'fake://fake/repo/base') self.s.add(parent) child1 = Dir(u'./test', u'test', u'fake://fake/repo/base') child1.parent = parent self.s.add(child1) child2 = Dir(u'./another_test', u'another_test', u'fake://fake/repo/base') child2.parent = parent self.s.add(child2) self.s.commit() eq_(str(parent), "Dir(u'.', 2 subdirs, 0 files)")
def test_subdirs(self): "Test Dir managing two subdirs" parent = Dir(u'.', u'/', u'fake://fake/repo/base') self.s.add(parent) child1 = Dir(u'./test', u'test', u'fake://fake/repo/base') child1.parent = parent self.s.add(child1) child2 = Dir(u'./another_test', u'another_test', u'fake://fake/repo/base') child2.parent = parent self.s.add(child2) self.s.commit() ok_(len(parent.subdirs) == 2) eq_(parent.subdirs[0], child1) eq_(parent.subdirs[1], child2)