def test_get_job_result(self): """Test get result of job""" Honeywell.load_account() job = self._submit_job() result = job.result() self.assertEqual(result.success, True) return result
def test_job_with_id(self): """Test creating a job with an id.""" Honeywell.load_account() backend = Honeywell.get_backend(self.backend_name) job = self._submit_job() job_id = job.job_id() credentials = backend.provider().credentials job_created_with_id = HoneywellJob(backend, job_id, self.api_cls(credentials)) result = job_created_with_id.result() self.assertEqual(result.success, True) return result
def _wrapper(self, *args, **kwargs): # To avoid checking the connection in each test global HAS_NET_CONNECTION # pylint: disable=global-statement if os.getenv('QISKIT_TEST_SKIP_ONLINE'): raise unittest.SkipTest('Skipping online tests') if HAS_NET_CONNECTION is None: HAS_NET_CONNECTION = _has_connection('qapi.honeywell.com', 443) if not HAS_NET_CONNECTION: raise unittest.SkipTest("Test requires internet connection.") try: Honeywell.load_account() except exceptions.HoneywellError: raise unittest.SkipTest( "Test requires valid, configured honeywell credentials") return func(self, *args, **kwargs)
def test_get_job_id(self): """Test get id of job""" Honeywell.load_account() job = self._submit_job() job_id = job.job_id() self.assertIsNotNone(job_id)
def test_get_creation_date(self): """Test get creation date of job""" Honeywell.load_account() job = self._submit_job() creation_date = job.creation_date() self.assertIsNotNone(creation_date)
def test_get_job_status(self): """Test get status of job""" job = self._submit_job() Honeywell.load_account() status = job.status() self.assertIsInstance(status, JobStatus)
def test_submit_job(self): """Test running a single circuit.""" Honeywell.load_account() job = self._submit_job() self.assertIsInstance(job, HoneywellJob)
def _submit_job(self): """Helper method to submit job and return job instance""" Honeywell.load_account() backend = Honeywell.get_backend(self.backend_name) return execute(self.circuit, backend)
def test_name(self): """Test backend.name().""" Honeywell.load_account() backend = Honeywell.get_backend(self.backend_name) name = backend.name() self.assertEqual(name, self.backend_name)
def test_status(self): """Test backend.status().""" Honeywell.load_account() backend = Honeywell.get_backend(self.backend_name) status = backend.status() self.assertIsInstance(status, BackendStatus)
def test_provider(self): """Test backend.provider().""" Honeywell.load_account() backend = Honeywell.get_backend(self.backend_name) provider = backend.provider() self.assertEqual(provider, self.provider_cls())