jalengg commented on code in PR #38398:
URL: https://github.com/apache/airflow/pull/38398#discussion_r1540561139


##########
tests/providers/google/cloud/hooks/test_gcs.py:
##########
@@ -565,6 +565,20 @@ def test_object_get_md5hash(self, mock_service):
 
         assert response == returned_file_md5hash
 
+    @mock.patch(GCS_STRING.format("GCSHook.get_conn"))
+    def test_object_get_metadata(self, mock_service):
+        test_bucket = "test_bucket"
+        test_object = "test_object"
+        returned_file_metadata = {"test_metadata_key": "test_metadata_val"}
+
+        bucket_method = mock_service.return_value.bucket
+        get_blob_method = bucket_method.return_value.get_blob
+        get_blob_method.return_value.metadata = returned_file_metadata
+
+        response = self.gcs_hook.get_metadata(bucket_name=test_bucket, 
object_name=test_object)
+
+        assert response == returned_file_metadata

Review Comment:
   Added a test for the ValueError when the object doesn't exist



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