ashb commented on a change in pull request #7741: [AIRFLOW-7076] Add support 
for HashiCorp Vault as Secrets Backend
URL: https://github.com/apache/airflow/pull/7741#discussion_r394657351
 
 

 ##########
 File path: tests/providers/hashicorp/secrets/test_vault.py
 ##########
 @@ -0,0 +1,137 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from unittest import TestCase, mock
+
+from hvac.exceptions import VaultError
+
+from airflow.providers.hashicorp.secrets.vault import VaultSecrets
+
+
+class TestVaultSecrets(TestCase):
+
+    @mock.patch("airflow.providers.hashicorp.secrets.vault.hvac")
+    def test_get_conn_uri(self, mock_hvac):
+        mock_client = mock.MagicMock()
+        mock_hvac.Client.return_value = mock_client
+        mock_client.secrets.kv.v2.read_secret_version.return_value = {
+            'request_id': '94011e25-f8dc-ec29-221b-1f9c1d9ad2ae',
+            'lease_id': '',
+            'renewable': False,
+            'lease_duration': 0,
+            'data': {
+                'data': {'test_postgres': 
'postgresql://airflow:airflow@host:5432/airflow'},
 
 Review comment:
   Right now this seems to be _all_ connections in a single path, with 
different values for each of them. I would have expected that each connection 
is it's own secret instead.
   
   (I'm guessing Vault lets you limit access based on path, but not on key?)

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


With regards,
Apache Git Services

Reply via email to