You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Taragolis (via GitHub)" <gi...@apache.org> on 2023/02/18 17:35:08 UTC
[GitHub] [airflow] Taragolis commented on a diff in pull request #29434: Impovements for RedshiftDataOperator
Taragolis commented on code in PR #29434:
URL: https://github.com/apache/airflow/pull/29434#discussion_r1111063142
##########
airflow/providers/amazon/aws/operators/redshift_data.py:
##########
@@ -25,6 +26,8 @@
from airflow.providers.amazon.aws.hooks.redshift_data import RedshiftDataHook
from airflow.providers.amazon.aws.utils import trim_none_values
+from mypy_boto3_redshift_data.type_defs import GetStatementResultResponseTypeDef
+
Review Comment:
Please move it under the `if TYPE_CHECKING:` block
##########
tests/providers/amazon/aws/operators/test_redshift_data.py:
##########
@@ -140,3 +140,39 @@ def test_batch_execute(self, mock_conn):
StatementName=statement_name,
WithEvent=False,
)
+
+ @mock.patch("airflow.providers.amazon.aws.hooks.redshift_data.RedshiftDataHook.conn")
+ def test_return_sql_result(self, mock_conn):
+ expected_result = {"Result": True}
+ mock_conn.execute_statement.return_value = {"Id": STATEMENT_ID}
Review Comment:
```suggestion
mock_conn.batch_execute_statement.return_value = {"Id": STATEMENT_ID}
```
You need to mock `batch_execute_statement` here because you call
https://github.com/apache/airflow/blob/2a34dc9e8470285b0ed2db71109ef4265e29688b/airflow/providers/amazon/aws/operators/redshift_data.py#L124-L136
You could check it locally in Breeze or venv, for more detail see: [Airflow Unit Tests](https://github.com/apache/airflow/blob/main/TESTING.rst#id3)
--
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