8282 "refreshIntervalMs" : 2000000 ,
8383}
8484TEST_TABLE = "test-table"
85+ GCP_CONN_ID = "google_cloud_default"
8586
8687
8788class TestBigQueryCreateEmptyTableOperator :
@@ -791,6 +792,7 @@ def test_execute(self, mock_hook, as_dict):
791792 max_results = 100
792793 selected_fields = "DATE"
793794 operator = BigQueryGetDataOperator (
795+ gcp_conn_id = GCP_CONN_ID ,
794796 task_id = TASK_ID ,
795797 dataset_id = TEST_DATASET ,
796798 table_id = TEST_TABLE_ID ,
@@ -799,8 +801,10 @@ def test_execute(self, mock_hook, as_dict):
799801 selected_fields = selected_fields ,
800802 location = TEST_DATASET_LOCATION ,
801803 as_dict = as_dict ,
804+ use_legacy_sql = False ,
802805 )
803806 operator .execute (None )
807+ mock_hook .assert_called_with (gcp_conn_id = GCP_CONN_ID , impersonation_chain = None , use_legacy_sql = False )
804808 mock_hook .return_value .list_rows .assert_called_once_with (
805809 dataset_id = TEST_DATASET ,
806810 table_id = TEST_TABLE_ID ,
@@ -818,12 +822,6 @@ def test_bigquery_get_data_operator_async_with_selected_fields(
818822 Asserts that a task is deferred and a BigQuerygetDataTrigger will be fired
819823 when the BigQueryGetDataOperator is executed with deferrable=True.
820824 """
821- job_id = "123456"
822- hash_ = "hash"
823- real_job_id = f"{ job_id } _{ hash_ } "
824-
825- mock_hook .return_value .insert_job .return_value = MagicMock (job_id = real_job_id , error_result = False )
826-
827825 ti = create_task_instance_of_operator (
828826 BigQueryGetDataOperator ,
829827 dag_id = "dag_id" ,
@@ -833,6 +831,7 @@ def test_bigquery_get_data_operator_async_with_selected_fields(
833831 max_results = 100 ,
834832 selected_fields = "value,name" ,
835833 deferrable = True ,
834+ use_legacy_sql = False ,
836835 )
837836
838837 with pytest .raises (TaskDeferred ) as exc :
@@ -851,12 +850,6 @@ def test_bigquery_get_data_operator_async_without_selected_fields(
851850 Asserts that a task is deferred and a BigQueryGetDataTrigger will be fired
852851 when the BigQueryGetDataOperator is executed with deferrable=True.
853852 """
854- job_id = "123456"
855- hash_ = "hash"
856- real_job_id = f"{ job_id } _{ hash_ } "
857-
858- mock_hook .return_value .insert_job .return_value = MagicMock (job_id = real_job_id , error_result = False )
859-
860853 ti = create_task_instance_of_operator (
861854 BigQueryGetDataOperator ,
862855 dag_id = "dag_id" ,
@@ -866,6 +859,7 @@ def test_bigquery_get_data_operator_async_without_selected_fields(
866859 max_results = 100 ,
867860 deferrable = True ,
868861 as_dict = as_dict ,
862+ use_legacy_sql = False ,
869863 )
870864
871865 with pytest .raises (TaskDeferred ) as exc :
@@ -886,6 +880,7 @@ def test_bigquery_get_data_operator_execute_failure(self, as_dict):
886880 max_results = 100 ,
887881 deferrable = True ,
888882 as_dict = as_dict ,
883+ use_legacy_sql = False ,
889884 )
890885
891886 with pytest .raises (AirflowException ):
@@ -904,6 +899,7 @@ def test_bigquery_get_data_op_execute_complete_with_records(self, as_dict):
904899 max_results = 100 ,
905900 deferrable = True ,
906901 as_dict = as_dict ,
902+ use_legacy_sql = False ,
907903 )
908904
909905 with mock .patch .object (operator .log , "info" ) as mock_log_info :
0 commit comments