sekikn commented on a change in pull request #12505:
URL: https://github.com/apache/airflow/pull/12505#discussion_r554579390
##########
File path: tests/providers/snowflake/transfers/test_s3_to_snowflake.py
##########
@@ -26,6 +26,42 @@
class TestS3ToSnowflakeTransfer(unittest.TestCase):
@mock.patch("airflow.providers.snowflake.hooks.snowflake.SnowflakeHook.run")
def test_execute(self, mock_run):
+ table = 'table'
+ stage = 'stage'
+ file_format = 'file_format'
+ schema = 'schema'
+
+ S3ToSnowflakeOperator(
+ s3_keys=None,
+ table=table,
+ stage=stage,
+ file_format=file_format,
+ schema=schema,
+ columns_array=None,
+ task_id="task_id",
+ dag=None,
+ ).execute(None)
+
+ base_sql = """
+ FROM @{stage}/
+
+ file_format={file_format}
+ """.format(
+ stage=stage, file_format=file_format
+ )
+
+ copy_query = """
+ COPY INTO {schema}.{table} {base_sql}
+ """.format(
+ schema=schema, table=table, base_sql=base_sql
+ )
+ copy_query = "\n".join(line.strip() for line in
copy_query.splitlines())
+
+ mock_run.assert_called_once()
+ assert_equal_ignore_multiple_spaces(self, mock_run.call_args[0][0],
copy_query)
+
+
@mock.patch("airflow.providers.snowflake.hooks.snowflake.SnowflakeHook.run")
+ def test_execute_with_s3_keys(self, mock_run):
Review comment:
Agreed, update the test case to be parametrized.
----------------------------------------------------------------
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:
[email protected]