def test_folder_two_children_str(self): folder = LocalFolder('stuff') folder.add_child(LocalFile('setup.py')) folder.add_child(LocalFile('requirements.txt')) self.assertEqual(get_file_or_folder_paths(folder), [ 'stuff', 'stuff/requirements.txt', 'stuff/setup.py', ])
def test_nested_folder_str(self): grand = LocalFolder('grand') parent = LocalFolder('parent') parent.add_child(LocalFile('setup.py')) parent.add_child(LocalFile('requirements.txt')) otherparent = LocalFolder('otherparent') grand.add_child(parent) grand.add_child(otherparent) self.assertEqual(get_file_or_folder_paths(grand), [ 'grand', 'grand/otherparent', 'grand/parent', 'grand/parent/requirements.txt', 'grand/parent/setup.py', ])
def test_folder_up_and_back(self): content = LocalFolder('../DukeDSClient') self.assertEqual('DukeDSClient', content.name)
def test_folder_name_no_slash(self): content = LocalFolder('/tmp/DukeDsClientTestFolder') self.assertEqual('DukeDsClientTestFolder', content.name) self.assertEqual('/tmp/DukeDsClientTestFolder', content.path)
def test_folder_dot_name(self): content = LocalFolder('.') self.assertEqual('DukeDSClient', content.name)
def test_nested_folder_str(self): grand = LocalFolder('grand') parent = LocalFolder('parent') parent.add_child(LocalFile('setup.py')) parent.add_child(LocalFile('requirements.txt')) otherparent = LocalFolder('otherparent') grand.add_child(parent) grand.add_child(otherparent) self.assertEqual(('folder:grand [' 'folder:parent [file:setup.py, file:requirements.txt], ' 'folder:otherparent []]'), str(grand))
def test_folder_two_children_str(self): folder = LocalFolder('stuff') folder.add_child(LocalFile('setup.py')) folder.add_child(LocalFile('requirements.txt')) self.assertEqual('folder:stuff [file:setup.py, file:requirements.txt]', str(folder))
def test_folder_one_child_str(self): folder = LocalFolder('stuff') folder.add_child(LocalFile('setup.py')) self.assertEqual('folder:stuff [file:setup.py]', str(folder))
def test_empty_folder_str(self): f = LocalFolder('stuff') self.assertEqual('folder:stuff []', str(f))
def test_folder_one_child_str(self): folder = LocalFolder('stuff') folder.add_child(LocalFile('setup.py')) self.assertEqual(get_file_or_folder_paths(folder), ['stuff', 'stuff/setup.py'])