From 49d035ce490fe615ed6c98942492a053fe6bb942 Mon Sep 17 00:00:00 2001 From: Conor Holden Date: Wed, 27 Nov 2024 10:27:16 +0100 Subject: [PATCH] :recycle:[#114] make config key names lowercase --- docs/setup_configuration.rst | 18 +++++++++--------- .../setup_configuration/steps.py | 4 ++-- pyproject.toml | 2 +- tests/setupconfig/files/defaults.yml | 4 ++-- tests/setupconfig/files/discovery.yml | 4 ++-- tests/setupconfig/files/discovery_disabled.yml | 4 ++-- tests/setupconfig/files/empty.yml | 4 ++-- tests/setupconfig/files/full_setup.yml | 4 ++-- tests/setupconfig/files/partial_endpoints.yml | 4 ++-- tests/setupconfig/test_steps.py | 17 ++++++----------- 10 files changed, 30 insertions(+), 35 deletions(-) diff --git a/docs/setup_configuration.rst b/docs/setup_configuration.rst index 6775ff2..8608d2e 100644 --- a/docs/setup_configuration.rst +++ b/docs/setup_configuration.rst @@ -30,22 +30,22 @@ Configuration Settings YAML: ============================ -The setup configuration admin must contain the following base keys to use setup configuration: +The setup configuration file must contain the following base keys to use this setup configuration step: -* ``OIDC_DB_CONFIG_ENABLE``: enable setup configuration step boolean +* ``oidc_db_config_enable``: enable setup configuration step boolean -* ``OIDC_DB_SETUP_CONFIG_ADMIN_AUTH``: Dictionary that maps OIDC fields to their values. +* ``oidc_db_config_admin_auth``: Dictionary that maps OIDC fields to their values. Example: .. code-block:: YAML - OTHER_ENABLE: True - OTHER_CONFiG: + other_enable: True + other_config: ... - OIDC_DB_CONFIG_ENABLE: True - OIDC_DB_SETUP_CONFIG_ADMIN_AUTH: + oidc_db_config_enable: True + oidc_db_config_admin_auth: oidc_rp_client_id: client-id oidc_rp_client_secret: secret endpoint_config: @@ -53,7 +53,7 @@ Example: ... -Any field from the ``OpenIDConnectConfig`` can be added to ``OIDC_DB_SETUP_CONFIG_ADMIN_AUTH`` (except endpoints, see below) +Any field from the ``OpenIDConnectConfig`` can be added to ``oidc_db_config_admin_auth`` (except endpoints, see below) Required Fields: """""""""""""""" @@ -79,7 +79,7 @@ Providing both will cause the validation to fail. Optional Fields: """""""""""""""" -All the following keys are placed in the ``OIDC_DB_SETUP_CONFIG_ADMIN_AUTH`` dictionary. +All the following keys are placed in the ``oidc_db_config_admin_auth`` dictionary. * ``oidc_op_jwks_endpoint``: URL of your OpenID Connect provider JSON Web Key Set endpoint. Required if ``RS256`` is used as signing algorithm. No default value. diff --git a/mozilla_django_oidc_db/setup_configuration/steps.py b/mozilla_django_oidc_db/setup_configuration/steps.py index fb06044..2a29942 100644 --- a/mozilla_django_oidc_db/setup_configuration/steps.py +++ b/mozilla_django_oidc_db/setup_configuration/steps.py @@ -16,8 +16,8 @@ class AdminOIDCConfigurationStep(BaseConfigurationStep[AdminOIDCConfigurationMod verbose_name = "Configuration for admin login via OpenID Connect" config_model = AdminOIDCConfigurationModel - namespace = "OIDC_DB_SETUP_CONFIG_ADMIN_AUTH" - enable_setting = "OIDC_DB_CONFIG_ENABLE" + namespace = "oidc_db_config_admin_auth" + enable_setting = "oidc_db_config_enable" def execute(self, model: AdminOIDCConfigurationModel) -> None: diff --git a/pyproject.toml b/pyproject.toml index f1ee62c..0e31c15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ Changelog = "https://github.com/maykinmedia/mozilla-django-oidc-db/blob/master/C [project.optional-dependencies] setupconfig = [ - "django-setup-configuration@git+https://github.com/maykinmedia/django-setup-configuration.git@ba0ed8a14acf0ffe05244f53b78fb343c6e5c3df", + "django-setup-configuration@git+https://github.com/maykinmedia/django-setup-configuration.git@c3cb480223d23d1220bd4aca0c57eb07aacaf637", ] tests = [ "psycopg2", diff --git a/tests/setupconfig/files/defaults.yml b/tests/setupconfig/files/defaults.yml index 3b32683..889c392 100644 --- a/tests/setupconfig/files/defaults.yml +++ b/tests/setupconfig/files/defaults.yml @@ -1,5 +1,5 @@ -OIDC_DB_CONFIG_ENABLE: True -OIDC_DB_SETUP_CONFIG_ADMIN_AUTH: +oidc_db_config_enable: True +oidc_db_config_admin_auth: oidc_rp_client_id: client-id oidc_rp_client_secret: secret endpoint_config: diff --git a/tests/setupconfig/files/discovery.yml b/tests/setupconfig/files/discovery.yml index a2b49a2..be8b924 100644 --- a/tests/setupconfig/files/discovery.yml +++ b/tests/setupconfig/files/discovery.yml @@ -1,5 +1,5 @@ -OIDC_DB_CONFIG_ENABLE: True -OIDC_DB_SETUP_CONFIG_ADMIN_AUTH: +oidc_db_config_enable: True +oidc_db_config_admin_auth: oidc_rp_client_id: testid oidc_rp_client_secret: 7DB3KUAAizYCcmZufpHRVOcD0TOkNO3I endpoint_config: diff --git a/tests/setupconfig/files/discovery_disabled.yml b/tests/setupconfig/files/discovery_disabled.yml index 06c9a05..45f19a9 100644 --- a/tests/setupconfig/files/discovery_disabled.yml +++ b/tests/setupconfig/files/discovery_disabled.yml @@ -1,5 +1,5 @@ -OIDC_DB_CONFIG_ENABLE: False -OIDC_DB_SETUP_CONFIG_ADMIN_AUTH: +oidc_db_config_enable: False +oidc_db_config_admin_auth: oidc_rp_client_id: testid oidc_rp_client_secret: 7DB3KUAAizYCcmZufpHRVOcD0TOkNO3I endpoint_config: diff --git a/tests/setupconfig/files/empty.yml b/tests/setupconfig/files/empty.yml index 65f1871..4d8d68b 100644 --- a/tests/setupconfig/files/empty.yml +++ b/tests/setupconfig/files/empty.yml @@ -1,2 +1,2 @@ -OIDC_DB_CONFIG_ENABLE: True -OIDC_DB_SETUP_CONFIG_ADMIN_AUTH: {} +oidc_db_config_enable: True +oidc_db_config_admin_auth: {} diff --git a/tests/setupconfig/files/full_setup.yml b/tests/setupconfig/files/full_setup.yml index 93ae072..cf06ee3 100644 --- a/tests/setupconfig/files/full_setup.yml +++ b/tests/setupconfig/files/full_setup.yml @@ -1,5 +1,5 @@ -OIDC_DB_CONFIG_ENABLE: True -OIDC_DB_SETUP_CONFIG_ADMIN_AUTH: +oidc_db_config_enable: True +oidc_db_config_admin_auth: oidc_rp_client_id: client-id oidc_rp_client_secret: secret oidc_rp_scopes_list: diff --git a/tests/setupconfig/files/partial_endpoints.yml b/tests/setupconfig/files/partial_endpoints.yml index 907f0b3..0f48892 100644 --- a/tests/setupconfig/files/partial_endpoints.yml +++ b/tests/setupconfig/files/partial_endpoints.yml @@ -1,5 +1,5 @@ -OIDC_DB_CONFIG_ENABLE: True -OIDC_DB_SETUP_CONFIG_ADMIN_AUTH: +oidc_db_config_enable: True +oidc_db_config_admin_auth: oidc_rp_client_id: client-id oidc_rp_client_secret: secret endpoint_config: diff --git a/tests/setupconfig/test_steps.py b/tests/setupconfig/test_steps.py index c682d8c..ced6803 100644 --- a/tests/setupconfig/test_steps.py +++ b/tests/setupconfig/test_steps.py @@ -84,13 +84,9 @@ def test_required_settings(): command_error.value ) - assert "OIDC_DB_SETUP_CONFIG_ADMIN_AUTH.oidc_rp_client_id" in str( - command_error.value - ) - assert "OIDC_DB_SETUP_CONFIG_ADMIN_AUTH.oidc_rp_client_secret" in str( - command_error.value - ) - assert "OIDC_DB_SETUP_CONFIG_ADMIN_AUTH.endpoint_config" in str(command_error.value) + assert "oidc_db_config_admin_auth.oidc_rp_client_id" in str(command_error.value) + assert "oidc_db_config_admin_auth.oidc_rp_client_secret" in str(command_error.value) + assert "oidc_db_config_admin_auth.endpoint_config" in str(command_error.value) config = OpenIDConnectConfig.get_solo() assert not config.enabled @@ -116,12 +112,11 @@ def test_partial_endpoints_provided(): ) assert ( - "OIDC_DB_SETUP_CONFIG_ADMIN_AUTH.endpoint_config.all.oidc_op_token_endpoint" + "oidc_db_config_admin_auth.endpoint_config.all.oidc_op_token_endpoint" in str(command_error.value) ) - assert ( - "OIDC_DB_SETUP_CONFIG_ADMIN_AUTH.endpoint_config.all.oidc_op_user_endpoint" - in str(command_error.value) + assert "oidc_db_config_admin_auth.endpoint_config.all.oidc_op_user_endpoint" in str( + command_error.value ) config = OpenIDConnectConfig.get_solo()