Skip to content

pytest_plugin: Add generic keycloak_oidc fixture instantiation

This will simplify fixture use in external modules that use the pytest plugin.

A second commit turns realm_name and client_id from the KeycloakOpenIDConnect class into properties. It enables to properly override those values by getting / setting them from / to the wrapped keycloak.KeycloakOpenID instance.

The purpose is to easily override the fixture and its parameters in external module tests, see below:

import pytest

pytest_plugins = ["swh.auth.pytest_plugin"]

@pytest.fixture
def keycloak_oidc(keycloak_oidc):
    keycloak_oidc.server_url = "..."
    keycloak_oidc.realm_name = "..."
    keycloak_oidc.client_id = "..."
    return keycloak_oidc

Migrated from D5344 (view on Phabricator)

Merge request reports