Exemplo n.º 1
0
    def test_jobstatusjson_incomplete(self):
        request = testing.DummyRequest()
        job = self.fake_job()
        job.id = 'bla'
        job.state = 'STOPPED'
        job.is_complete.return_value = True
        views = InCompleteJobViews(job, request)

        response = views.job_status_json()

        self.assertEqual(
            response, dict(
                status='STOPPED',
                jobid='bla',
                is_complete=True,
            ))
Exemplo n.º 2
0
    def test_jobstatusjson_completewitherror(self):
        request = testing.DummyRequest()
        job = self.fake_job()
        job.id = 'bla'
        job.state = 'ERROR'
        job.is_complete.side_effect = JobError(job)
        views = InCompleteJobViews(job, request)

        response = views.job_status_json()

        self.assertEqual(response,
                         dict(
                             status='ERROR',
                             jobid='bla',
                             is_complete=True,
                         ))
Exemplo n.º 3
0
    def test_jobstatusjson_complete(self):
        request = testing.DummyRequest()
        job = self.fake_job()
        job.id = 'bla'
        job.state = 'RUNNING'
        job.is_complete.side_effect = JobIncomplete(job)
        views = InCompleteJobViews(job, request)

        response = views.job_status_json()

        self.assertEqual(
            response, dict(
                status='RUNNING',
                jobid='bla',
                is_complete=False,
            ))