diff --git a/swh/auth/pytest_plugin.py b/swh/auth/pytest_plugin.py --- a/swh/auth/pytest_plugin.py +++ b/swh/auth/pytest_plugin.py @@ -13,7 +13,14 @@ import pytest from swh.auth.keycloak import KeycloakOpenIDConnect -from swh.auth.tests.sample_data import OIDC_PROFILE, RAW_REALM_PUBLIC_KEY, USER_INFO +from swh.auth.tests.sample_data import ( + CLIENT_ID, + OIDC_PROFILE, + RAW_REALM_PUBLIC_KEY, + REALM_NAME, + SERVER_URL, + USER_INFO, +) class KeycloackOpenIDConnectMock(KeycloakOpenIDConnect): @@ -193,3 +200,10 @@ # for backward compatibility # TODO: remove that alias once swh-deposit and swh-web use new function name keycloak_mock_factory = keycloak_oidc_factory + +# generic keycloak fixture that can be used within tests +# (cf. test_keycloak.py, test_utils.py, django related tests) +# or external modules using that pytest plugin +keycloak_oidc = keycloak_oidc_factory( + server_url=SERVER_URL, realm_name=REALM_NAME, client_id=CLIENT_ID, +) diff --git a/swh/auth/tests/conftest.py b/swh/auth/tests/conftest.py deleted file mode 100644 --- a/swh/auth/tests/conftest.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2021 The Software Heritage developers -# See the AUTHORS file at the top-level directory of this distribution -# License: GNU Affero General Public License version 3, or any later version -# See top-level LICENSE file for more information - - -from swh.auth.pytest_plugin import keycloak_oidc_factory -from swh.auth.tests.sample_data import CLIENT_ID, REALM_NAME, SERVER_URL - -# keycloak fixture used within tests (cf. test_keycloak.py, test_utils.py) -keycloak_oidc = keycloak_oidc_factory( - server_url=SERVER_URL, realm_name=REALM_NAME, client_id=CLIENT_ID, -)