You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/05/06 10:00:32 UTC

[GitHub] [airflow] nic314 commented on a change in pull request #13394: Add rest API to query for providers

nic314 commented on a change in pull request #13394:
URL: https://github.com/apache/airflow/pull/13394#discussion_r627280826



##########
File path: tests/api_connexion/endpoints/test_provider_endpoint.py
##########
@@ -0,0 +1,127 @@
+# 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.
+
+import unittest
+from collections import OrderedDict
+from unittest import mock
+
+from airflow.security import permissions
+from airflow.www import app
+from tests.test_utils.api_connexion_utils import create_user, delete_user
+from tests.test_utils.config import conf_vars
+
+MOCK_PROVIDERS = OrderedDict(
+    [
+        (
+            'apache-airflow-providers-amazon',
+            (
+                '1.0.0',
+                {
+                    'package-name': 'apache-airflow-providers-amazon',
+                    'name': 'Amazon',
+                    'description': '`Amazon Web Services (AWS) <https://aws.amazon.com/>`__.\n',
+                    'versions': ['1.0.0'],
+                },
+            ),
+        ),
+        (
+            'apache-airflow-providers-apache-cassandra',
+            (
+                '1.0.0',
+                {
+                    'package-name': 'apache-airflow-providers-apache-cassandra',
+                    'name': 'Apache Cassandra',
+                    'description': '`Apache Cassandra <http://cassandra.apache.org/>`__.\n',
+                    'versions': ['1.0.0'],
+                },
+            ),
+        ),
+    ]
+)
+
+
+class TestBaseProviderEndpoint(unittest.TestCase):
+    @classmethod
+    def setUpClass(cls) -> None:
+        with conf_vars({("api", "auth_backend"): "tests.test_utils.remote_user_api_auth_backend"}):
+            cls.app = app.create_app(testing=True)  # type:ignore
+        create_user(
+            cls.app,  # type:ignore
+            username="test",
+            role_name="Test",
+            permissions=[(permissions.ACTION_CAN_READ, permissions.RESOURCE_PROVIDER)],  # type: ignore
+        )
+        create_user(cls.app, username="test_no_permissions", role_name="TestNoPermissions")  # type: ignore
+

Review comment:
       i will do asap, i think within today




-- 
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:
users@infra.apache.org