def test_get_upload_directory(self): m = ParamManager(self.settings, self.request.session) d = m.get_upload_directory() assert os.path.isdir(d) del self.request.session['username'] d = m.get_upload_directory() assert os.path.isdir(d)
def upload_file_into_history(self, filename): """Upload a file (present in user upload directory) into the testing history :param filename: the file to upload """ param_manager = ParamManager(self.settings, self.request.session) src_file = param_manager.get_upload_directory() self.galaxy_instance.tools.upload_file(src_file + filename, self.history_id, file_name=filename)
def test_send_to_history(self): """Test the send_to_history method""" galaxy_connector = GalaxyConnector(self.settings, self.request.session, self.galaxy['url'], self.galaxy['key']) param_manager = ParamManager(self.settings, self.request.session) src_file = param_manager.get_upload_directory() filepath = src_file + 'play_instrument.tsv' galaxy_connector.send_to_history(filepath, 'play_instrument.tsv', 'tabular') assert self.interface_galaxy.check_dataset_presence('play_instrument.tsv') is True
def test_send_to_history(self): """Test the send_to_history method""" galaxy_connector = GalaxyConnector(self.settings, self.request.session, self.galaxy['url'], self.galaxy['key']) param_manager = ParamManager(self.settings, self.request.session) src_file = param_manager.get_upload_directory() filepath = src_file + 'play_instrument.tsv' galaxy_connector.send_to_history(filepath, 'play_instrument.tsv', 'tabular') assert self.interface_galaxy.check_dataset_presence( 'play_instrument.tsv') is True
def __init__(self, request): self.log = logging.getLogger(__name__) self.request = request request.response.headers['Access-Control-Allow-Origin'] = '*' request.response.headers['Access-Control-Allow-Methods'] = 'OPTIONS, HEAD, GET, POST, PUT, DELETE' #self.dir_string = '__' + self.request.session['username'] + '__' # Set the tmp dir #if 'upload_directory' not in request.session.keys() or self.dir_string not in request.session['upload_directory'] or not os.path.isdir(request.session['upload_directory']): # request.session['upload_directory'] = tempfile.mkdtemp(suffix='_tmp', prefix='__' + self.request.session['username'] + '__') self.settings = request.registry.settings pm = ParamManager(self.settings, self.request.session) self.upload_dir = pm.get_upload_directory() #self.upload_dir = request.session['upload_directory'] self.log.debug("upload_directory => "+self.upload_dir) self.allowed_types = self.settings["askomics.allowed_file_types"] self.delete_method = self.settings["askomics.delete_method"] self.min_size = int(self.settings["askomics.upload_min_size"]) self.max_size = int(self.settings["askomics.upload_max_size"])