Skip to content

Commit

Permalink
Reorganize testsuite
Browse files Browse the repository at this point in the history
- All directories are now setup to work with RHSSO
- Identity is different as that is the only one which reverts it
- Move Multiple_hosts out of RHSSO folder
  • Loading branch information
pehala committed Aug 4, 2022
1 parent ec6ab77 commit 647d7b5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
16 changes: 12 additions & 4 deletions testsuite/tests/kuadrant/authorino/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
from weakget import weakget

from testsuite.httpx.auth import HttpxOidcClientAuth
from testsuite.openshift.objects.auth_config import AuthConfig
from testsuite.objects import Authorino, Authorization, PreexistingAuthorino
from testsuite.openshift.objects.authorino import AuthorinoCR
Expand All @@ -28,12 +29,19 @@ def authorino(authorino, openshift, blame, request, testconfig, label) -> Author

# pylint: disable=unused-argument
@pytest.fixture(scope="module")
def authorization(authorization, authorino, envoy, blame, openshift, label) -> Authorization:
def authorization(authorization, authorino, envoy, blame, openshift, label, rhsso_service_info) -> Authorization:
"""In case of Authorino, AuthConfig used for authorization"""
if authorization:
return authorization
if authorization is None:
authorization = AuthConfig.create_instance(openshift, blame("ac"), envoy.hostname, labels={"testRun": label})
authorization.add_oidc_identity("rhsso", rhsso_service_info.issuer_url())
return authorization

return AuthConfig.create_instance(openshift, blame("ac"), envoy.hostname, labels={"testRun": label})

@pytest.fixture(scope="module")
def auth(rhsso_service_info):
"""Returns RHSSO authentication object for HTTPX"""
return HttpxOidcClientAuth(rhsso_service_info.client, "authorization",
rhsso_service_info.username, rhsso_service_info.password)


@pytest.fixture(scope="module")
Expand Down
9 changes: 9 additions & 0 deletions testsuite/tests/kuadrant/authorino/identity/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Conftest for all Identity tests"""
import pytest


@pytest.fixture(scope="module")
def authorization(authorization):
"""For Identity tests remove all identities previously setup"""
authorization.remove_all_identities()
return authorization

0 comments on commit 647d7b5

Please sign in to comment.