def _make_dir(self, method, *args, **kwargs): """Creates a directory in the datastore.""" ds_path = kwargs.get("name") if _db_content.get("files", None) is None: raise exception.NoFilesFound() if get_file(ds_path): raise error_util.FileAlreadyExistsException() _db_content["files"].append('%s/' % ds_path)
def test_create_folder_if_missing_exception(self): ds_name, ds_ref, ops, path, dc = self._setup_create_folder_mocks() ds_util.mkdir.side_effect = error_util.FileAlreadyExistsException() ops._create_folder_if_missing(ds_name, ds_ref, 'folder') ds_util.mkdir.assert_called_with(ops._session, path, dc)
def test_create_cache_folder_with_exception(self): ds_name, ds_ref, ops, path = self._setup_create_cache_mocks() ops._mkdir.side_effect = error_util.FileAlreadyExistsException() ops.create_cache_folder(ds_name, ds_ref) # assert that the ops._mkdir.assert_called_with(path, ds_ref)