Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
    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"])