dinigo commented on a change in pull request #17592:
URL: https://github.com/apache/airflow/pull/17592#discussion_r692071092
##########
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:
You mean mocking also the BaseHook and checking that call arguments
match the `** hook_kwargs`? you are right
--
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]