def test_child_of_root(self): CHILD_NAME = 'child-name' child = GitViewFSObject(name=CHILD_NAME) _root_dir = Directory(name='does not matter', items=[child]) path = child.get_path() self.assertEqual('/' + CHILD_NAME, path)
def test_child_of_non_root(self): CHILD_NAME = 'child-name' child = GitViewFSObject(name=CHILD_NAME) NON_ROOT_DIR_PATH = 'non-root-dir-path' class NonRootDirectory(Directory): def get_path(self): return NON_ROOT_DIR_PATH def is_root(self): return False _non_root_dir = NonRootDirectory(name='does not matter', items=[child]) path = child.get_path() self.assertEqual(NON_ROOT_DIR_PATH + '/' + CHILD_NAME, path)