Ejemplo n.º 1
0
    def tes_listJobs(self):
        import os

        jm = JobManager(self.settings, self.request.session)
        os.remove(jm.pathdb)

        l = jm.listJobs()
Ejemplo n.º 2
0
    def tes_drop(self):
        import os

        jm = JobManager(self.settings, self.request.session)
        os.remove(jm.pathdb)

        l = jm.drop()
Ejemplo n.º 3
0
    def tes_drop(self):
        import os

        jm = JobManager(self.settings, self.request.session)
        os.remove(jm.pathdb)

        l = jm.drop()
Ejemplo n.º 4
0
    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))
Ejemplo n.º 5
0
    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))
Ejemplo n.º 6
0
    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,"")
Ejemplo n.º 7
0
    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))
Ejemplo n.º 8
0
    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
Ejemplo n.º 9
0
    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
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
    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()
Ejemplo n.º 12
0
    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()
Ejemplo n.º 13
0
    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
Ejemplo n.º 14
0
    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))
Ejemplo n.º 15
0
 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)
Ejemplo n.º 16
0
    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
Ejemplo n.º 17
0
    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
Ejemplo n.º 18
0
    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
Ejemplo n.º 19
0
    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, "")
Ejemplo n.º 20
0
 def test_removeJob(self):
     jm = JobManager(self.settings, self.request.session)
     jm.removeJob("aaa")
     jm.removeJob(-1)
     jm.removeJob(44)
Ejemplo n.º 21
0
 def test_removeJob(self):
     jm = JobManager(self.settings, self.request.session)
     jm.removeJob("aaa")
     jm.removeJob(-1)
     jm.removeJob(44)
Ejemplo n.º 22
0
    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)
Ejemplo n.º 23
0
    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)