Exemplo n.º 1
0
    def test_set_jobstatus(self):
        request = testing.DummyRequest(content_type='text/plain')
        request.body = 'STOPPED'
        job = self.fake_job()
        job.id = 'bla'
        job.state = 'RUNNING'
        views = InCompleteJobViews(job, request)

        response = views.set_job_status()

        self.assertEqual(response, dict(status='STOPPED', jobid='bla'))
        self.assertEqual(job.state, 'STOPPED')
Exemplo n.º 2
0
    def test_set_jobstatus_withjson_doneerr_exitcode(self):
        body = '{"state": "STOPPED", "exitCode": 1, "running": false, '
        body += '"done": true, "schedulerSpecficInformation": null, '
        body += '"exception": null}'
        request = testing.DummyRequest(
            content_type='application/json',
            charset='UTF-8',
            body=body,
        )
        job = self.fake_job()
        job.id = 'bla'
        job.state = 'PENDING'
        views = InCompleteJobViews(job, request)

        response = views.set_job_status()

        self.assertEqual(response, dict(status='ERROR', jobid='bla'))
        self.assertEqual(job.state, 'ERROR')