Taragolis commented on code in PR #35037:
URL: https://github.com/apache/airflow/pull/35037#discussion_r1364522281


##########
tests/providers/amazon/aws/hooks/test_s3.py:
##########
@@ -1047,6 +1047,33 @@ def 
test_download_file_with_preserve_name_file_already_exists(self, tmp_path):
                 use_autogenerated_subdir=False,
             )
 
+    @mock.patch.object(S3Hook, "get_session")
+    def test_download_file_with_extra_args_sanitizes_values(self, 
mock_session):
+        bucket = "test_bucket"
+        s3_key = "test_key"
+        encryption_key = "abcd123"
+
+        s3_hook = S3Hook(
+            extra_args={
+                "SSECustomerKey": encryption_key,
+                "SSECustomerAlgorithm": "AES256",
+                "invalid_arg": "should be dropped",
+            }
+        )
+
+        mock_obj = Mock()
+        mock_resource = Mock()
+        mock_resource.resource.return_value = mock_obj
+        mock_session.return_value = mock_resource
+
+        s3_hook.download_file(key=s3_key, bucket_name=bucket)
+
+        mock_obj.load.assert_called_once_with(
+            key=s3_key,
+            bucket_name=bucket,
+            extra_args={"SSECustomerKey": encryption_key, 
"SSECustomerAlgorithm": "AES256"},
+        )

Review Comment:
   This one should fix
   
   ---
   
   This part only for help in debugger
   ```python
           mock_obj = Mock(name="MockedS3Object")
           mock_resource = Mock(name="MockedBoto3Resource")
   ```
   
   
![image](https://github.com/apache/airflow/assets/3998685/9bb33c88-7573-421b-95be-ece29f171c37)
   



-- 
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-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to