コード例 #1
0
    def test_submit_job(self):
        service = TAPService('http://example.com/tap')
        job = service.submit_job('http://example.com/tap',
                                 "SELECT * FROM ivoa.obscore")

        assert job.url == 'http://example.com/tap/async/' + job.job_id
        assert job.phase == 'PENDING'
        assert job.execution_duration == TimeDelta(3600, format='sec')
        assert isinstance(job.destruction, Time)
        assert isinstance(job.quote, Time)

        job.run()
        job.wait()
        job.delete()
コード例 #2
0
ファイル: test_tap.py プロジェクト: pyvirtobs/pyvo
    def test_submit_job(self):
        service = TAPService('http://example.com/tap')
        job = service.submit_job(
            'http://example.com/tap', "SELECT * FROM ivoa.obscore")

        assert job.url == 'http://example.com/tap/async/' + job.job_id
        assert job.phase == 'PENDING'
        assert job.execution_duration == TimeDelta(3600, format='sec')
        assert isinstance(job.destruction, Time)
        assert isinstance(job.quote, Time)

        job.run()
        job.wait()
        job.delete()
コード例 #3
0
    def test_modify_job(self):
        service = TAPService('http://example.com/tap')
        job = service.submit_job(
            "SELECT * FROM ivoa.obscore",
            uploads={'one': 'http://example.com/uploads/one'})
        job.query = "SELECT TOP 42 * FROM ivoa.obsCore"
        job.upload(two='http://example.com/uploads/two')

        for parameter in job._job.parameters:
            if parameter.id_ == 'query':
                assert parameter.content == 'SELECT TOP 42 * FROM ivoa.obsCore'
                break
            elif parameter.id_ == 'upload':
                assert ('one=http://example.com/uploads/one'
                        in parameter.content)
                assert ('two=http://example.com/uploads/two'
                        in parameter.content)
コード例 #4
0
    def test_tables(self):
        service = TAPService('http://example.com/tap')
        tables = service.tables

        assert list(tables.keys()) == ['test.table1', 'test.table2']

        table1, table2 = list(tables)
        self._test_tables(table1, table2)
コード例 #5
0
ファイル: test_tap.py プロジェクト: pyvirtobs/pyvo
    def test_modify_job(self):
        service = TAPService('http://example.com/tap')
        job = service.submit_job(
            "SELECT * FROM ivoa.obscore", uploads={
                'one': 'http://example.com/uploads/one'
            })
        job.query = "SELECT TOP 42 * FROM ivoa.obsCore"
        job.upload(two='http://example.com/uploads/two')

        for parameter in job._job.parameters:
            if parameter.id_ == 'query':
                assert parameter.content == 'SELECT TOP 42 * FROM ivoa.obsCore'
                break
            elif parameter.id_ == 'upload':
                assert (
                    'one=http://example.com/uploads/one' in parameter.content)
                assert (
                    'two=http://example.com/uploads/two' in parameter.content)
コード例 #6
0
ファイル: test_tap.py プロジェクト: trjaffe/pyvo
 def test_get_job_list(self):
     service = TAPService('http://example.com/tap')
     # server returns:
     #       - 3 jobs for last atribute
     #       - 2 jobs for phase attribute
     #       - 1 job for after attribute
     # Tests consists in counting the cumulative number of jobs as per
     # above rules
     after = datetime.datetime.now()
     assert len(service.get_job_list()) == 0
     assert len(service.get_job_list(last=3)) == 3
     assert len(service.get_job_list(after='2018-04-25T17:46:01Z')) == 1
     assert len(service.get_job_list(phases=['EXECUTING'])) == 2
     assert len(service.get_job_list(after=after,
                                     phases=['EXECUTING'])) == 3
     assert len(service.get_job_list(after='2018-04-25T17:46:01.123Z',
                                     last=3)) == 4
     assert len(service.get_job_list(phases=['EXECUTING'], last=3)) == 5
     assert len(service.get_job_list(phases=['EXECUTING'], last=3,
                                     after=datetime.datetime.now())) == 6
コード例 #7
0
    def test_upload_methods(self):
        service = TAPService('http://example.com/tap')
        upload_methods = service.upload_methods

        assert upload_methods[0].ivo_id == (
            'ivo://ivoa.net/std/TAPRegExt#upload-https')
        assert upload_methods[1].ivo_id == (
            'ivo://ivoa.net/std/TAPRegExt#upload-ftp')
        assert upload_methods[2].ivo_id == (
            'ivo://ivoa.net/std/TAPRegExt#upload-inline')
        assert upload_methods[3].ivo_id == (
            'ivo://ivoa.net/std/TAPRegExt#upload-http')
コード例 #8
0
 def test_get_job(self):
     service = TAPService('http://example.com/tap')
     job = service.get_job('111')
     assert job.jobid == '111'
     assert job.phase == 'EXECUTING'
     assert job.ownerid == '222'
コード例 #9
0
 def test_run_async(self):
     service = TAPService('http://example.com/tap')
     results = service.run_async("SELECT * FROM ivoa.obscore")
     _test_image_results(results)
コード例 #10
0
    def test_hardlimit(self):
        service = TAPService('http://example.com/tap')

        assert service.hardlimit == 10000000
コード例 #11
0
    def test_maxrec(self):
        service = TAPService('http://example.com/tap')

        assert service.maxrec == 20000
コード例 #12
0
    def test_examples(self):
        service = TAPService('http://example.com/tap')
        examples = service.examples

        self._test_examples(examples)
コード例 #13
0
    def test_init(self):
        service = TAPService('http://example.com/tap')

        assert service.baseurl == 'http://example.com/tap'
コード例 #14
0
ファイル: test_tap.py プロジェクト: pyvirtobs/pyvo
 def test_run_async(self):
     service = TAPService('http://example.com/tap')
     results = service.run_async("SELECT * FROM ivoa.obscore")
     _test_image_results(results)