Skip to content

Commit

Permalink
🚧[#144] add optional setup config
Browse files Browse the repository at this point in the history
  • Loading branch information
Coperh committed Jul 10, 2024
1 parent 5a40eeb commit e2c21cd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ 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 }}) )

services:
postgres:
Expand Down
31 changes: 24 additions & 7 deletions tests/setupconfig/test_auth.py
Original file line number Diff line number Diff line change
@@ -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"


Expand All @@ -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
Expand Down

0 comments on commit e2c21cd

Please sign in to comment.