From 4448ce7774b94fcc352331743d60956000219598 Mon Sep 17 00:00:00 2001 From: averevki Date: Tue, 28 Nov 2023 22:55:38 +0100 Subject: [PATCH] Remove unnecessary identities management --- .../authorino/identity/api_key/test_auth_credentials.py | 1 - .../authorino/identity/rhsso/test_auth_credentials.py | 1 - testsuite/tests/kuadrant/conftest.py | 4 +--- testsuite/tests/kuadrant/reconciliation/conftest.py | 7 ------- testsuite/tests/kuadrant/test_rate_limit_authz.py | 5 +++-- 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/testsuite/tests/kuadrant/authorino/identity/api_key/test_auth_credentials.py b/testsuite/tests/kuadrant/authorino/identity/api_key/test_auth_credentials.py index a973d6de..e6132eca 100644 --- a/testsuite/tests/kuadrant/authorino/identity/api_key/test_auth_credentials.py +++ b/testsuite/tests/kuadrant/authorino/identity/api_key/test_auth_credentials.py @@ -13,7 +13,6 @@ def credentials(request): @pytest.fixture(scope="module") def authorization(authorization, api_key, credentials): """Add API key identity to AuthConfig""" - authorization.identity.clear_all() authorization.identity.add_api_key( "api_key", credentials=Credentials(credentials, "APIKEY"), selector=api_key.selector ) diff --git a/testsuite/tests/kuadrant/authorino/identity/rhsso/test_auth_credentials.py b/testsuite/tests/kuadrant/authorino/identity/rhsso/test_auth_credentials.py index 45b5a386..df580f62 100644 --- a/testsuite/tests/kuadrant/authorino/identity/rhsso/test_auth_credentials.py +++ b/testsuite/tests/kuadrant/authorino/identity/rhsso/test_auth_credentials.py @@ -13,7 +13,6 @@ def credentials(request): @pytest.fixture(scope="module") def authorization(authorization, rhsso, credentials): """Add RHSSO identity to Authorization""" - authorization.identity.clear_all() authorization.identity.add_oidc("rhsso", rhsso.well_known["issuer"], credentials=Credentials(credentials, "Token")) return authorization diff --git a/testsuite/tests/kuadrant/conftest.py b/testsuite/tests/kuadrant/conftest.py index 0eb5622b..a5d8b378 100644 --- a/testsuite/tests/kuadrant/conftest.py +++ b/testsuite/tests/kuadrant/conftest.py @@ -39,9 +39,7 @@ def authorization_name(blame): def authorization(authorino, kuadrant, oidc_provider, route, authorization_name, openshift, module_label): """Authorization object (In case of Kuadrant AuthPolicy)""" if kuadrant: - policy = AuthPolicy.create_instance(openshift, authorization_name, route, labels={"testRun": module_label}) - policy.identity.add_oidc("rhsso", oidc_provider.well_known["issuer"]) - return policy + return AuthPolicy.create_instance(openshift, authorization_name, route, labels={"testRun": module_label}) return None diff --git a/testsuite/tests/kuadrant/reconciliation/conftest.py b/testsuite/tests/kuadrant/reconciliation/conftest.py index 6889d71e..7d219647 100644 --- a/testsuite/tests/kuadrant/reconciliation/conftest.py +++ b/testsuite/tests/kuadrant/reconciliation/conftest.py @@ -3,13 +3,6 @@ import pytest -@pytest.fixture(scope="module") -def authorization(authorization): - """Add anonymous identity""" - authorization.identity.add_anonymous("anonymous") - return authorization - - @pytest.fixture(scope="module", autouse=True) def commit(request, authorization): """Only commit authorization""" diff --git a/testsuite/tests/kuadrant/test_rate_limit_authz.py b/testsuite/tests/kuadrant/test_rate_limit_authz.py index d37de536..92693207 100644 --- a/testsuite/tests/kuadrant/test_rate_limit_authz.py +++ b/testsuite/tests/kuadrant/test_rate_limit_authz.py @@ -25,8 +25,9 @@ def rate_limit(rate_limit): @pytest.fixture(scope="module") -def authorization(authorization): - """Adds JSON injection, that wraps the response as Envoy Dynamic Metadata for rate limit""" +def authorization(authorization, oidc_provider): + """Adds rhsso identity and JSON injection, that wraps the response as Envoy Dynamic Metadata for rate limit""" + authorization.identity.add_oidc("rhsso", oidc_provider.well_known["issuer"]) authorization.responses.add_success_dynamic( "identity", JsonResponse({"user": ValueFrom("auth.identity.preferred_username")}) )