def test__set_properties_no_stats(self): config = {"test": True} resource = {"configuration": config} job = self._set_properties_job() job._set_properties(resource) self.assertEqual(job._properties, resource)
def test__set_properties_w_end_time(self): now, millis = self._datetime_and_millis() config = {"test": True} stats = {"endTime": str(millis)} resource = {"configuration": config, "statistics": stats} job = self._set_properties_job() job._set_properties(resource) cleaned = copy.deepcopy(resource) cleaned["statistics"]["endTime"] = float(millis) self.assertEqual(job._properties, cleaned)
def test_result_explicit_w_state(self): conn = _make_connection() client = _make_client(project=self.PROJECT, connection=conn) job = self._make_one(self.JOB_ID, client) # Use _set_properties() instead of directly modifying _properties so # that the result state is set properly. job_resource = job._properties job_resource["status"] = {"state": "DONE"} job._set_properties(job_resource) timeout = 1 self.assertIs(job.result(timeout=timeout), job) conn.api_request.assert_not_called()