rogalski commented on code in PR #46096:
URL: https://github.com/apache/airflow/pull/46096#discussion_r1932743304


##########
providers/tests/amazon/aws/transfers/test_http_to_s3.py:
##########
@@ -60,12 +60,34 @@ def test_execute(self, requests_mock):
         conn = boto3.client("s3")
         conn.create_bucket(Bucket=self.s3_bucket)
         operator = HttpToS3Operator(
-            task_id="s3_to_file_sensor",
+            task_id="http_to_s3_operator",
+            http_conn_id=self.http_conn_id,
+            endpoint=self.endpoint,
+            s3_key=self.s3_key,
+            s3_bucket=self.s3_bucket,
+            dag=self.dag,
+        )
+        operator.execute(None)
+
+        objects_in_bucket = conn.list_objects(Bucket=self.s3_bucket, 
Prefix=self.s3_key)
+        # there should be object found, and there should only be one object 
found
+        assert len(objects_in_bucket["Contents"]) == 1
+        # the object found should be consistent with dest_key specified earlier
+        assert objects_in_bucket["Contents"][0]["Key"] == self.s3_key
+
+    @mock_aws
+    def test_execute_stream(self, requests_mock):
+        requests_mock.register_uri("GET", EXAMPLE_URL, content=self.response)
+        conn = boto3.client("s3")
+        conn.create_bucket(Bucket=self.s3_bucket)
+        operator = HttpToS3Operator(
+            task_id="http_to_s3_operator",
             http_conn_id=self.http_conn_id,
             endpoint=self.endpoint,
             s3_key=self.s3_key,
             s3_bucket=self.s3_bucket,
             dag=self.dag,
+            extra_options={"stream": True},
         )
         operator.execute(None)
 

Review Comment:
   @o-nikolas Just to clarify - we want to explicitly check that different 
boto3 methods were called even if we do not mock them out?
   
   Technically should be doable.
   
   In practical terms I'd expect that coverage data from test suite would be 
enough.
   
   Please confirm if you see this as a blocker or if this is just an open 
question.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to