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 2021/09/20 22:20:06 UTC

[GitHub] [airflow] kazanzhy commented on a change in pull request #17592: Support for passing arguments to SqlSensor underlying hooks

kazanzhy commented on a change in pull request #17592:
URL: https://github.com/apache/airflow/pull/17592#discussion_r712553155



##########
File path: tests/sensors/test_sql_sensor.py
##########
@@ -242,6 +242,22 @@ def test_sql_sensor_postgres_poke_invalid_success(self, mock_hook):
             op.poke(None)
         assert "self.success is present, but not callable -> [1]" == str(ctx.value)
 
+    @mock.patch('airflow.sensors.sql.BaseHook')
+    def test_sql_sensor_bigquery_hook_kwargs(self, mock_hook):
+        op = SqlSensor(
+            task_id='sql_sensor_check',
+            conn_id='postgres_default',
+            sql="SELECT 1",
+            hook_kwargs={
+                'use_legacy_sql': False,
+                'location': 'test_location',
+            },
+        )
+
+        mock_hook.get_connection('google_cloud_default').conn_type = "google_cloud_platform"
+        assert op._get_hook().use_legacy_sql
+        assert op._get_hook().location == 'test_location'

Review comment:
       I think there may be the AssertionError due to `op._get_hook().use_legacy_sql` is False.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org