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/11/15 15:36:28 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #6396: [AIRFLOW-5726] Delete table as file name in RedshiftToS3Transfer

kaxil commented on a change in pull request #6396: [AIRFLOW-5726] Delete table as file name in RedshiftToS3Transfer
URL: https://github.com/apache/airflow/pull/6396#discussion_r346881062
 
 

 ##########
 File path: tests/operators/test_redshift_to_s3_operator.py
 ##########
 @@ -51,23 +52,68 @@ def test_execute(self, mock_run, mock_session):
             redshift_conn_id="redshift_conn_id",
             aws_conn_id="aws_conn_id",
             task_id="task_id",
+            table_as_file_name=table_as_file_name,
             dag=None
         ).execute(None)
 
         unload_options = '\n\t\t\t'.join(unload_options)
         select_query = "SELECT * FROM {schema}.{table}".format(schema=schema, table=table)
         unload_query = """
-                UNLOAD ('{select_query}')
-                TO 's3://{s3_bucket}/{s3_key}/{table}_'
-                with credentials
-                'aws_access_key_id={access_key};aws_secret_access_key={secret_key}'
-                {unload_options};
-                """.format(select_query=select_query,
-                           table=table,
-                           s3_bucket=s3_bucket,
-                           s3_key=s3_key,
-                           access_key=access_key,
-                           secret_key=secret_key,
-                           unload_options=unload_options)
+                    UNLOAD ('{select_query}')
+                    TO 's3://{s3_bucket}/{s3_key}/{table}_'
+                    with credentials
+                    'aws_access_key_id={access_key};aws_secret_access_key={secret_key}'
+                    {unload_options};
+                    """.format(select_query=select_query,
+                               table=table,
+                               s3_bucket=s3_bucket,
+                               s3_key=s3_key,
+                               access_key=access_key,
+                               secret_key=secret_key,
+                               unload_options=unload_options)
+
+        assert mock_run.call_count == 1
+        assertEqualIgnoreMultipleSpaces(self, mock_run.call_args[0][0], unload_query)
+
+    def test_execute_false(self, mock_run, mock_session):
 
 Review comment:
   You can use parameterized in `def test_execute` instead of creating new test

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