Exemplo n.º 1
0
    def testRepeatAnalysis(self):
        state = helper_functions.server({'request':'get_analyses'})
        n = len(state['analyses'])
        #test analysis not already present:
        self.assertFalse(os.path.exists(self.rdp_analysis_dir))
        
        server_request = {'request': 'exec_analysis',
                          'analysis_type': u'rdp',
                          'job_description': u'test',
                          'seperator': u'_',
                          'data_file_sha1sum': self.analysis_id,
                          'data_file_path': self.test_fasta_file,
                          'return_when_done': True}

        helper_functions.server(server_request)
        #request was executed:
        self.assertTrue(os.path.exists(self.rdp_analysis_dir))

        state = helper_functions.server({'request':'get_analyses'})
        self.assertTrue(len(state['analyses']) == n+1) 
        #try to run the analysis again:
        server_response = helper_functions.server(server_request)
        #len should still be n+1:
        self.assertTrue(len(state['analyses']) == n+1)
        #clean up:
        rm_request = {'request': 'remove_analysis',
                          'analysis_id': self.analysis_id}
        helper_functions.server(rm_request)
        state = helper_functions.server({'request':'get_analyses'})
        #remove was successful:
        self.assertTrue(len(state['analyses']) == n)
Exemplo n.º 2
0
 def testEnvCreation(self):
     server_request = {'request': 'exec_analysis',
                       'analysis_type': u'rdp',
                       'job_description': u'test',
                       'seperator': u'_',
                       'data_file_sha1sum': self.analysis_id,
                       'data_file_path': self.test_fasta_file,
                       'return_when_done': True}
     
     helper_functions.server(server_request)
     self.assertTrue(os.path.exists(self.rdp_analysis_dir))
     self.assertTrue(os.path.exists(os.path.join(self.rdp_analysis_dir,c.env_file_name)))
     #clean up:
     rm_request = {'request': 'remove_analysis',
                       'analysis_id': self.analysis_id}
     helper_functions.server(rm_request)
Exemplo n.º 3
0
 def testServerError(self):
     server_request = {'request': 'exec_analysis',
                       'analysis_type': u'bad_value',
                       'job_description': u'test',
                       'seperator': u'_',
                       'data_file_sha1sum': self.analysis_id,
                       'data_file_path': self.test_fasta_file,
                       'return_when_done': True}
     response = helper_functions.server(server_request)
     self.assertTrue(response['response'] == 'error')
     self.assertFalse(os.path.exists(self.rdp_analysis_dir))
Exemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     super(BlastUploadForm, self).__init__(*args, **kwargs)
     req = {"request": "list", "resource": "blastdb"}
     resp = helper_functions.server(req)
     self.fields["db_name"] = forms.ChoiceField(choices=[(r["id"], r["id"]) for r in resp["resources"]])
Exemplo n.º 5
0
 def server(self, request):
     return helper_functions.server(request)