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/10/17 22:43:52 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #6351: [AIRFLOW-5682] Allow labels in gcs_to_bq operator

mik-laj commented on a change in pull request #6351: [AIRFLOW-5682] Allow labels in gcs_to_bq operator
URL: https://github.com/apache/airflow/pull/6351#discussion_r336258244
 
 

 ##########
 File path: tests/gcp/hooks/test_bigquery.py
 ##########
 @@ -732,6 +733,29 @@ def run_with_config(config):
         assert mocked_rwc.call_count == 1
 
 
+class TestLabelsInRunLoad(unittest.TestCase):
+    @mock.patch.object(hook.BigQueryBaseCursor, 'run_with_configuration')
+    def test_run_query_with_arg(self, mocked_rwc):
+        project_id = '12345'
+
+        def run_with_config(config):
+            self.assertEqual(
+                config['labels'], {'label1': 'test1', 'label2': 'test2',
+                                   'airflow-version': hook._AIRFLOW_VERSION}
+            )
+        mocked_rwc.side_effect = run_with_config
 
 Review comment:
   Can you use assert_called_once_with instead creating special function?  This will make the code clearer.

----------------------------------------------------------------
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