def test_done_defaults_wo_state(self): from google.cloud.bigquery.retry import DEFAULT_RETRY client = _make_client(project=self.PROJECT) job = self._make_one(self.JOB_ID, client) reload_ = job.reload = mock.Mock() self.assertFalse(job.done()) reload_.assert_called_once_with(retry=DEFAULT_RETRY, timeout=None)
def test_done_explicit_wo_state(self): from google.cloud.bigquery.retry import DEFAULT_RETRY client = _make_client(project=self.PROJECT) job = self._make_one(self.JOB_ID, client) reload_ = job.reload = mock.Mock() retry = DEFAULT_RETRY.with_deadline(1) self.assertFalse(job.done(retry=retry, timeout=7.5)) reload_.assert_called_once_with(retry=retry, timeout=7.5)
def test_done(self): client = _make_client(project=self.PROJECT) resource = self._make_resource(ended=True) job = self._get_target_class().from_api_repr(resource, client) self.assertTrue(job.done())
def test_done_already(self): client = _make_client(project=self.PROJECT) job = self._make_one(self.JOB_ID, client) job._properties["status"] = {"state": "DONE"} self.assertTrue(job.done())