vincbeck commented on code in PR #37947: URL: https://github.com/apache/airflow/pull/37947#discussion_r1516886060
########## tests/system/providers/amazon/aws/tests/test_aws_auth_manager.py: ########## @@ -0,0 +1,211 @@ +# 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 __future__ import annotations + +from pathlib import Path +from unittest.mock import Mock, patch + +import boto3 +import pytest + +from airflow.www import app as application +from tests.system.providers.amazon.aws.utils import set_env_id +from tests.test_utils.config import conf_vars +from tests.test_utils.www import check_content_in_response + +pytest.importorskip("onelogin") + +SAML_METADATA_URL = "/saml/metadata" +SAML_METADATA_PARSED = { + "idp": { + "entityId": "https://portal.sso.us-east-1.amazonaws.com/saml/assertion/<assertion>", + "singleSignOnService": { + "url": "https://portal.sso.us-east-1.amazonaws.com/saml/assertion/<assertion>", + "binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect", + }, + "singleLogoutService": { + "url": "https://portal.sso.us-east-1.amazonaws.com/saml/logout/<assertion>", + "binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect", + }, + "x509cert": "<cert>", + }, + "security": {"authnRequestsSigned": False}, + "sp": {"NameIDFormat": "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"}, +} + +AVP_POLICY_ADMIN = """ +permit ( + principal in Airflow::Role::"Admin", + action, + resource +); +""" + +env_id_cache: str | None = None +policy_store_id_cache: str | None = None + + +def create_avp_policy_store(env_id): + description = f"Created by system test TestAwsAuthManager: {env_id}" + client = boto3.client("verifiedpermissions") + response = client.create_policy_store( + validationSettings={"mode": "OFF"}, + description=description, + ) + policy_store_id = response["policyStoreId"] + + schema_path = ( + Path(__file__) + .parents[6] + .joinpath("airflow", "providers", "amazon", "aws", "auth_manager", "cli", "schema.json") Review Comment: Yes, this is not a big deal. It is in the same provider package, and the usage makes sense -- 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]
