def test_status_done(self):
        api_mock = Mock()
        api_mock.get_result.return_value = AcQuantumResultResponse(
            real_result=[
                AcQuantumResult(result_id=12,
                                seed=100,
                                shots=10,
                                start_time='2019-01-11',
                                measure_qubits=11,
                                finish_time='2019-01-08')
            ])

        job = AcQuantumJob(None, '100', api_mock, True)
        status = job.status()
        self.assertEqual(status, AcQuantumJobStatus.DONE)
    def test_status_queued(self):
        api_mock = Mock()
        api_mock.get_result.return_value = AcQuantumResultResponse(
            real_result=[
                AcQuantumResult(result_id=12,
                                seed=100,
                                shots=10,
                                start_time='',
                                measure_qubits=11,
                                process='c32c')
            ])

        job = AcQuantumJob(None, '100', api_mock, True)
        status = job.status()
        self.assertEqual(status, AcQuantumJobStatus.QUEUED)
        self.assertEqual(job.get_queue_position(), '32')
 def test_cancel(self):
     api_mock = Mock()
     api_mock.get_result.return_value = AcQuantumResultResponse(
         real_result=[
             AcQuantumResult(result_id=12,
                             seed=100,
                             shots=10,
                             start_time='2019-01-11',
                             measure_qubits=11,
                             finish_time=None,
                             process="",
                             exception=None)
         ])
     job = AcQuantumJob(None, '100', api_mock, True)
     job.cancel()
     api_mock.get_result.return_value = AcQuantumResultResponse([], [])
     self.assertEqual(AcQuantumJobStatus.CANCELLED, job.status())