def tes_listJobs(self): import os jm = JobManager(self.settings, self.request.session) os.remove(jm.pathdb) l = jm.listJobs()
def tes_drop(self): import os jm = JobManager(self.settings, self.request.session) os.remove(jm.pathdb) l = jm.drop()
def tes_drop(self): import os jm = JobManager(self.settings, self.request.session) os.remove(jm.pathdb) l = jm.drop()
def test_save_integration_job(self): self.tps.clean_up() self.tps.add_jdoe_in_users() job_manager = JobManager(self.settings, self.request.session) job_manager.save_integration_job('file.tsv', 1) assert self.tps.test_row_presence('integration', 'user_id, filename, state, end, error', (1, 'file.tsv', 'wait', None, None))
def test_query_job(self): self.tps.clean_up() self.tps.add_jdoe_in_users() job_manager = JobManager(self.settings, self.request.session) job_manager.save_query_job('graph_string', '_s3_7B_s3_27variate_s3_27_s3_3A_s3_20_s3_5B_s3_27_s3_3Fvariate_s3_27_s3_5D_s3_7D', 1) assert self.tps.test_row_presence('query', 'user_id, state, end, data, file, preview, graph, variates, nrows, error', (1, 'wait', None, None, None, None, 'graph_string', '_s3_7B_s3_27variate_s3_27_s3_3A_s3_20_s3_5B_s3_27_s3_3Fvariate_s3_27_s3_5D_s3_7D', None, None))
def test_updatePreviewJob(self): try: jm = JobManager(self.settings, self.request.session) jm.updatePreviewJob(-1,None) assert False except Exception as e: assert True jm.updatePreviewJob(-1,"")
def test_save_integration_job(self): self.tps.clean_up() self.tps.add_jdoe_in_users() job_manager = JobManager(self.settings, self.request.session) job_manager.save_integration_job('file.tsv') assert self.tps.test_row_presence( 'integration', 'user_id, filename, state, end, error', (1, 'file.tsv', 'wait', None, None))
def test_listJobs(self): import os jm = JobManager(self.settings, self.request.session) l = jm.listJobs() os.remove(jm.pathdb) try: l = jm.listJobs() assert False except Exception as e: assert True
def test_listJobs(self): import os jm = JobManager(self.settings, self.request.session) l = jm.listJobs() os.remove(jm.pathdb) try: l = jm.listJobs() assert False except Exception as e: assert True
def test_saveStartSparqlJob(self): jm = JobManager(self.settings, self.request.session) d = jm.saveStartSparqlJob("TypeBidon", "{}") jm.removeJob(d) del self.request.session['username'] d = jm.saveStartSparqlJob("", "{}") jm.removeJob(d)
def setUp(self): """Set up the settings and session""" self.settings = get_appsettings('configs/test.virtuoso.ini', name='main') self.settings['askomics.upload_user_data_method'] = 'insert' self.request = testing.DummyRequest() self.request.session['username'] = '******' self.request.session['group'] = 'base' self.request.session['admin'] = False self.request.session['blocked'] = True self.request.session['graph'] = "test/nosetest/jdoe" jm = JobManager(self.settings, self.request.session) jm.drop()
def setUp(self): """Set up the settings and session""" self.settings = get_appsettings('configs/test.virtuoso.ini', name='main') self.settings['askomics.upload_user_data_method'] = 'insert' self.request = testing.DummyRequest() self.request.session['username'] = '******' self.request.session['group'] = 'base' self.request.session['admin'] = False self.request.session['blocked'] = True self.request.session['graph'] = "test/nosetest/jdoe" jm = JobManager(self.settings, self.request.session) jm.drop()
def test_list_integration_jobs(self): self.tps.clean_up() self.tps.add_jdoe_in_users() job_manager = JobManager(self.settings, self.request.session) job_manager.save_integration_job('file.tsv') job_manager.save_integration_job('file2.tsv') job_manager.done_integration_job(2) result = job_manager.list_integration_jobs() assert len(result) == 2
def test_query_job(self): self.tps.clean_up() self.tps.add_jdoe_in_users() job_manager = JobManager(self.settings, self.request.session) job_manager.save_query_job( 'graph_string', '_s3_7B_s3_27variate_s3_27_s3_3A_s3_20_s3_5B_s3_27_s3_3Fvariate_s3_27_s3_5D_s3_7D' ) assert self.tps.test_row_presence( 'query', 'user_id, state, end, data, file, preview, graph, variates, nrows, error', (1, 'wait', None, None, None, None, 'graph_string', '_s3_7B_s3_27variate_s3_27_s3_3A_s3_20_s3_5B_s3_27_s3_3Fvariate_s3_27_s3_5D_s3_7D', None, None))
def test_saveStartSparqlJob(self): jm = JobManager(self.settings, self.request.session) d = jm.saveStartSparqlJob("TypeBidon","{}") jm.removeJob(d) del self.request.session['username'] d = jm.saveStartSparqlJob("","{}") jm.removeJob(d)
def test_list_integration_jobs(self): self.tps.clean_up() self.tps.add_jdoe_in_users() job_manager = JobManager(self.settings, self.request.session) job_manager.save_integration_job('file.tsv', 1) job_manager.save_integration_job('file2.tsv', 1) job_manager.done_integration_job(2) result = job_manager.list_integration_jobs(1) assert len(result) == 2
def test_list_query_jobs(self): self.tps.clean_up() self.tps.add_jdoe_in_users() job_manager = JobManager(self.settings, self.request.session) job_manager.save_query_job('graph_string', '_s3_7B_s3_27variate_s3_27_s3_3A_s3_20_s3_5B_s3_27_s3_3Fvariate_s3_27_s3_5D_s3_7D', 1) job_manager.save_query_job('graph_string2', '_s3_7B_s3_27variate_s3_27_s3_3A_s3_20_s3_5B_s3_27_s3_3Fvariate_s3_27_s3_5D_s3_7D', 1) job_manager.done_query_job(2, 15, 'data_string2', 'file_string2') result = job_manager.list_query_jobs(1) assert len(result) == 2
def test_list_query_jobs(self): self.tps.clean_up() self.tps.add_jdoe_in_users() job_manager = JobManager(self.settings, self.request.session) job_manager.save_query_job( 'graph_string', '_s3_7B_s3_27variate_s3_27_s3_3A_s3_20_s3_5B_s3_27_s3_3Fvariate_s3_27_s3_5D_s3_7D' ) job_manager.save_query_job( 'graph_string2', '_s3_7B_s3_27variate_s3_27_s3_3A_s3_20_s3_5B_s3_27_s3_3Fvariate_s3_27_s3_5D_s3_7D' ) job_manager.done_query_job(2, 15, 'data_string2', 'file_string2') result = job_manager.list_query_jobs() assert len(result) == 2
def test_updatePreviewJob(self): try: jm = JobManager(self.settings, self.request.session) jm.updatePreviewJob(-1, None) assert False except Exception as e: assert True jm.updatePreviewJob(-1, "")
def test_removeJob(self): jm = JobManager(self.settings, self.request.session) jm.removeJob("aaa") jm.removeJob(-1) jm.removeJob(44)
def test_removeJob(self): jm = JobManager(self.settings, self.request.session) jm.removeJob("aaa") jm.removeJob(-1) jm.removeJob(44)
def test_updateEndSparqlJob(self): jm = JobManager(self.settings, self.request.session) jobid = jm.saveStartSparqlJob("TypeBidon", "{}") jm.updateEndSparqlJob(jobid, "Hello") l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" jm.updateEndSparqlJob(jobid, "Hello", nr=10) l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" assert l[0]['nr'] == 10 jm.updateEndSparqlJob(jobid, "Hello", data={"a": "b"}) l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" assert l[0]['data'] == {'a': 'b'} jm.updateEndSparqlJob(jobid, "Hello", file="test.tsv") l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" assert l[0]['file'] == "test.tsv" jm.updateEndSparqlJob(jobid, "Hello", file="test.tsv", data={'test': ['t1', 't2']}) l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" assert l[0]['file'] == "test.tsv" jm.removeJob(jobid)
def test_updateEndSparqlJob(self): jm = JobManager(self.settings, self.request.session) jobid = jm.saveStartSparqlJob("TypeBidon","{}") jm.updateEndSparqlJob(jobid,"Hello") l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" jm.updateEndSparqlJob(jobid,"Hello",nr=10) l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" assert l[0]['nr'] == 10 jm.updateEndSparqlJob(jobid,"Hello",data={ "a" : "b" }) l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" assert l[0]['data'] == { 'a' : 'b' } jm.updateEndSparqlJob(jobid,"Hello",file="test.tsv") l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" assert l[0]['file'] == "test.tsv" jm.updateEndSparqlJob(jobid,"Hello",file="test.tsv",data={'test': ['t1','t2']}) l = jm.listJobs() assert len(l) == 1 assert l[0]['state'] == "Hello" assert l[0]['file'] == "test.tsv" jm.removeJob(jobid)