phanikumv commented on a change in pull request #21385:
URL: https://github.com/apache/airflow/pull/21385#discussion_r801554034



##########
File path: tests/providers/google/cloud/hooks/test_bigquery.py
##########
@@ -943,6 +943,35 @@ def test_dbapi_get_sqlalchemy_engine(self):
         ):
             self.hook.get_sqlalchemy_engine()
 
+    @mock.patch("airflow.providers.google.cloud.hooks.bigquery.QueryJob")
+    
@mock.patch("airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_client")
+    def test_insert_job_with_async(self, mock_client, mock_query_job):
+        job_conf = {
+            "query": {
+                "query": "SELECT * FROM test",
+                "useLegacySql": "False",
+            }
+        }
+        mock_query_job._JOB_TYPE = "query"
+
+        self.hook.insert_job(
+            configuration=job_conf, job_id=JOB_ID, project_id=PROJECT_ID, 
location=LOCATION, is_async=True
+        )
+
+        mock_client.assert_called_once_with(
+            project_id=PROJECT_ID,
+            location=LOCATION,
+        )
+
+        mock_query_job.from_api_repr.assert_called_once_with(
+            {
+                'configuration': job_conf,
+                'jobReference': {'jobId': JOB_ID, 'projectId': PROJECT_ID, 
'location': LOCATION},
+            },
+            mock_client.return_value,
+        )
+        mock_query_job.from_api_repr.return_value._begin.assert_called_once()

Review comment:
       parameterized test_insert_job with is_async flag being passed using a 
pytest fixture with True and False.Since the test class _BigQueryBaseTestClass 
inherits from unittest.TestCase , the pytest.mark.parameterize does not work 
and hence updated the test class to not inherit from TestCase by renaming 
setupMethod to setup_method




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to