def test_process_files(self): """Test moving of files""" conf = {'path': './tests/files/done'} self.setup() process_files('tests/files', 'tests/files/done') storage = FolderStorage(conf) result = storage.list_dir() self.assertListEqual(sorted(result), sorted(TEST_FILE_LIST))
def test_file_path_listing(self): """Check file list works""" conf = {'path': './tests/files'} self.setup() storage = FolderStorage(conf) result = storage.list_dir() self.assertListEqual(sorted(result), sorted(TEST_FILE_LIST)) for file_name in result: storage.read_file(file_name) self.teardown()
def test_copy_files_local(self): """Tests files are not removed from local source when copying""" self.setup() conf = {'path': 'tests/files'} process_files('tests/files', 'tests/files/done', "True") storage_source = FolderStorage(conf) storage_dest = FolderStorage({'path': 'tests/files/done'}) source = storage_source.list_dir() dest = storage_dest.list_dir() self.assertEqual(source, dest) self.assertNotEqual(len(source), 0)
def test_folder_storage_delete(self): """" Tests the folder storage delete function last as files are Used in other tests """ conf = {'path': 'tests/files'} self.setup() storage = FolderStorage(conf) result = storage.list_dir() for file_name in result: storage.delete_file(file_name) result = storage.list_dir() self.assertEqual(len(result), 0)