From 5d2463fa099129f53628e1a276fc5687069e25b9 Mon Sep 17 00:00:00 2001 From: Conor Holden Date: Wed, 10 Jul 2024 10:37:38 +0200 Subject: [PATCH] :construction:[#144] add optional setup config --- .github/workflows/ci.yml | 3 ++- tests/setupconfig/test_auth.py | 31 ++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9cd176..abe0b7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,8 @@ jobs: mozilla_django_oidc: ['4.0'] setupconfig_enabled: ['no', 'yes'] - name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }}, mozilla-django-oidc ${{ matrix.mozilla_django_oidc }}) + name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }}, | + mozilla-django-oidc ${{ matrix.mozilla_django_oidc }}, Setup Config ${{ matrix.setupconfig_enabled }}) ) services: postgres: diff --git a/tests/setupconfig/test_auth.py b/tests/setupconfig/test_auth.py index 67ee952..7ad8ec0 100644 --- a/tests/setupconfig/test_auth.py +++ b/tests/setupconfig/test_auth.py @@ -1,9 +1,11 @@ import pytest -from mozilla_django_oidc_db.models import OpenIDConnectConfig, UserInformationClaimsSources +from mozilla_django_oidc_db.models import ( + OpenIDConnectConfig, + UserInformationClaimsSources, +) from mozilla_django_oidc_db.setupconfig.auth import AdminOIDCConfigurationStep - IDENTITY_PROVIDER = "sdfsdfsdfsdfsd" @@ -19,16 +21,31 @@ def test_configure(): assert config.oidc_rp_sign_algo == "RS256" assert config.oidc_rp_idp_sign_key == "key" assert config.oidc_op_discovery_endpoint == "" - assert config.oidc_op_jwks_endpoint == f"{IDENTITY_PROVIDER}protocol/openid-connect/certs" - assert config.oidc_op_authorization_endpoint == f"{IDENTITY_PROVIDER}protocol/openid-connect/auth" - assert config.oidc_op_token_endpoint == f"{IDENTITY_PROVIDER}protocol/openid-connect/token" - assert config.oidc_op_user_endpoint == f"{IDENTITY_PROVIDER}protocol/openid-connect/userinfo" + assert ( + config.oidc_op_jwks_endpoint + == f"{IDENTITY_PROVIDER}protocol/openid-connect/certs" + ) + assert ( + config.oidc_op_authorization_endpoint + == f"{IDENTITY_PROVIDER}protocol/openid-connect/auth" + ) + assert ( + config.oidc_op_token_endpoint + == f"{IDENTITY_PROVIDER}protocol/openid-connect/token" + ) + assert ( + config.oidc_op_user_endpoint + == f"{IDENTITY_PROVIDER}protocol/openid-connect/userinfo" + ) assert config.username_claim == "claim_name" assert config.groups_claim == "groups_claim_name" assert config.claim_mapping == {"first_name": "given_name"} assert not config.sync_groups assert config.sync_groups_glob_pattern == "local.groups.*" - assert list(group.name for group in config.default_groups.all()) == ["Admins", "Read-only"] + assert list(group.name for group in config.default_groups.all()) == [ + "Admins", + "Read-only", + ] assert config.make_users_staff assert config.superuser_group_names == ["superuser"] assert not config.oidc_use_nonce