ivica-k commented on a change in pull request #11227:
URL: https://github.com/apache/airflow/pull/11227#discussion_r512942731



##########
File path: tests/providers/amazon/aws/transfers/test_redshift_to_s3.py
##########
@@ -66,24 +70,79 @@ def test_execute(
             task_id="task_id",
             table_as_file_name=table_as_file_name,
             dag=None,
-        ).execute(None)
+        )
+
+        op.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}'
-                    with credentials
-                    
'aws_access_key_id={access_key};aws_secret_access_key={secret_key}'
-                    {unload_options};
-                    """.format(
-            select_query=select_query,
+        credentials_block = build_credentials_block(mock_session.return_value)
+
+        unload_query = op._build_unload_query(
+            credentials_block, select_query, expected_s3_key, unload_options
+        )

Review comment:
       Yeah, some hints are definitely needed. I tried literally what you said; 
made the `_build_unload_query` function return `"GOATS"` and all 4 tests failed
   
   ```
   AssertionError: assert 'aws_access_key_id' in 'GOATS'
   AssertionError: assert 'ASIA_aws_access_key_id' in 'GOATS'
   # ... etc
   ```
   
   As I said, I'm not the greatest when it comes to writing tests. I'd 
appreciate any pointers once you (or anyone else) gets some time. Thanks.




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


Reply via email to