You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/04/15 16:28:59 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #5101: [AIRFLOW-4319] Add tests for Bigquery related Operators

kaxil commented on a change in pull request #5101: [AIRFLOW-4319] Add tests for Bigquery related Operators
URL: https://github.com/apache/airflow/pull/5101#discussion_r275444108
 
 

 ##########
 File path: tests/contrib/operators/test_bigquery_operator.py
 ##########
 @@ -250,3 +255,125 @@ def test_bigquery_operator_defaults(self, mock_hook):
         ti = TaskInstance(task=operator, execution_date=DEFAULT_DATE)
         ti.render_templates()
         self.assertTrue(isinstance(ti.task.sql, six.string_types))
+
+
+class BigQueryGetDataOperatorTest(unittest.TestCase):
+
+    @mock.patch('airflow.contrib.operators.bigquery_get_data.BigQueryHook')
+    def test_execute(self, mock_hook):
+
+        max_results = '100'
+        selected_fields = 'DATE'
+        operator = BigQueryGetDataOperator(task_id=TASK_ID,
+                                           dataset_id=TEST_DATASET,
+                                           table_id=TEST_TABLE_ID,
+                                           max_results=max_results,
+                                           selected_fields=selected_fields,
+                                           )
+        operator.execute(None)
+        mock_hook.return_value \
+            .get_conn() \
 
 Review comment:
   Thanks for the suggestion.
   I Updated in https://github.com/apache/airflow/pull/5101/commits/2a68fb9ea6990a9cacf94675664a41704983dc5a
   
   @feluelle Will there be any other difference between those 2 (`()` & `return_value `). Or when you would you want to use `()` instead of `return_value` ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services