From fe94eb9c683e8468ba3d65f1cbf535dd78158b4a Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 17 Feb 2025 12:51:16 +0100 Subject: [PATCH 1/8] :arrow_up: [#521] Upgrade django-setup-configuration to 0.7.1 --- requirements/base.txt | 8 +++++++- requirements/ci.txt | 23 ++++++++++++++++++----- requirements/dev.txt | 21 ++++++++++++++++----- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 802b5dac..2f4f8080 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -148,7 +148,7 @@ django-sendfile2==0.7.0 # via django-privates django-sessionprofile==3.0.0 # via open-api-framework -django-setup-configuration==0.5.0 +django-setup-configuration==0.7.1 # via # -r requirements/base.in # mozilla-django-oidc-db @@ -183,6 +183,8 @@ djangorestframework-gis==1.0 # via open-api-framework djangorestframework-inclusions==1.2.0 # via open-api-framework +docutils==0.21.2 + # via django-setup-configuration drf-nested-routers==0.94.1 # via commonground-api-common drf-spectacular==0.27.2 @@ -312,6 +314,10 @@ requests==2.32.3 # zgw-consumers requests-mock==1.12.1 # via commonground-api-common +ruamel-yaml==0.18.10 + # via django-setup-configuration +ruamel-yaml-clib==0.2.12 + # via ruamel-yaml sentry-sdk==2.12.0 # via open-api-framework setuptools==75.6.0 diff --git a/requirements/ci.txt b/requirements/ci.txt index cb9408c6..4b7044dc 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -282,7 +282,7 @@ django-sessionprofile==3.0.0 # -c requirements/base.txt # -r requirements/base.txt # open-api-framework -django-setup-configuration==0.5.0 +django-setup-configuration==0.7.1 # via # -c requirements/base.txt # -r requirements/base.txt @@ -335,8 +335,11 @@ djangorestframework-inclusions==1.2.0 # -c requirements/base.txt # -r requirements/base.txt # open-api-framework -docutils==0.18.1 +docutils==0.21.2 # via + # -c requirements/base.txt + # -r requirements/base.txt + # django-setup-configuration # recommonmark # sphinx # sphinx-rtd-theme @@ -646,6 +649,16 @@ requests-mock==1.12.1 # -r requirements/base.txt # -r requirements/test-tools.in # commonground-api-common +ruamel-yaml==0.18.10 + # via + # -c requirements/base.txt + # -r requirements/base.txt + # django-setup-configuration +ruamel-yaml-clib==0.2.12 + # via + # -c requirements/base.txt + # -r requirements/base.txt + # ruamel-yaml sentry-sdk==2.12.0 # via # -c requirements/base.txt @@ -671,16 +684,16 @@ snowballstemmer==2.2.0 # via sphinx soupsieve==2.2.1 # via beautifulsoup4 -sphinx==7.1.2 +sphinx==8.1.3 # via # -r requirements/docs.in # recommonmark # sphinx-rtd-theme # sphinx-tabs # sphinxcontrib-jquery -sphinx-rtd-theme==2.0.0 +sphinx-rtd-theme==3.0.2 # via -r requirements/docs.in -sphinx-tabs==3.4.4 +sphinx-tabs==3.4.7 # via -r requirements/docs.in sphinxcontrib-applehelp==2.0.0 # via sphinx diff --git a/requirements/dev.txt b/requirements/dev.txt index a4a45793..2b75ed21 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -321,7 +321,7 @@ django-sessionprofile==3.0.0 # -c requirements/ci.txt # -r requirements/ci.txt # open-api-framework -django-setup-configuration==0.5.0 +django-setup-configuration==0.7.1 # via # -c requirements/ci.txt # -r requirements/ci.txt @@ -376,10 +376,11 @@ djangorestframework-inclusions==1.2.0 # -c requirements/ci.txt # -r requirements/ci.txt # open-api-framework -docutils==0.18.1 +docutils==0.21.2 # via # -c requirements/ci.txt # -r requirements/ci.txt + # django-setup-configuration # recommonmark # sphinx # sphinx-rtd-theme @@ -776,6 +777,16 @@ rich==13.9.4 # rich-click rich-click==1.8.5 # via bump-my-version +ruamel-yaml==0.18.10 + # via + # -c requirements/ci.txt + # -r requirements/ci.txt + # django-setup-configuration +ruamel-yaml-clib==0.2.12 + # via + # -c requirements/ci.txt + # -r requirements/ci.txt + # ruamel-yaml sentry-sdk==2.12.0 # via # -c requirements/ci.txt @@ -810,7 +821,7 @@ soupsieve==2.2.1 # -c requirements/ci.txt # -r requirements/ci.txt # beautifulsoup4 -sphinx==7.1.2 +sphinx==8.1.3 # via # -c requirements/ci.txt # -r requirements/ci.txt @@ -819,12 +830,12 @@ sphinx==7.1.2 # sphinx-rtd-theme # sphinx-tabs # sphinxcontrib-jquery -sphinx-rtd-theme==2.0.0 +sphinx-rtd-theme==3.0.2 # via # -c requirements/ci.txt # -r requirements/ci.txt # -r requirements/dev.in -sphinx-tabs==3.4.4 +sphinx-tabs==3.4.7 # via # -c requirements/ci.txt # -r requirements/ci.txt From 377c6642d2107fb2ecc90533026f87f9283b2b53 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 17 Feb 2025 12:51:56 +0100 Subject: [PATCH 2/8] :arrow_up: [#521] Upgrade zgw-consumers to 0.37.0 --- requirements/base.txt | 2 +- requirements/ci.txt | 2 +- requirements/dev.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 2f4f8080..952c39f0 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -366,7 +366,7 @@ webencodings==0.5.1 # via bleach wrapt==1.14.1 # via elastic-apm -zgw-consumers==0.36.1 +zgw-consumers==0.37.0 # via # -r requirements/base.in # commonground-api-common diff --git a/requirements/ci.txt b/requirements/ci.txt index 4b7044dc..046fba01 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -792,7 +792,7 @@ wrapt==1.14.1 # vcrpy yarl==1.9.4 # via vcrpy -zgw-consumers==0.36.1 +zgw-consumers==0.37.0 # via # -c requirements/base.txt # -r requirements/base.txt diff --git a/requirements/dev.txt b/requirements/dev.txt index 2b75ed21..12bdcec1 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -986,7 +986,7 @@ yarl==1.9.4 # -c requirements/ci.txt # -r requirements/ci.txt # vcrpy -zgw-consumers==0.36.1 +zgw-consumers==0.37.0 # via # -c requirements/ci.txt # -r requirements/ci.txt From a161510681aee6164207d98e5a39d4be455a725a Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 17 Feb 2025 12:52:22 +0100 Subject: [PATCH 3/8] :arrow_up: [#521] Upgrade notifications-api-common to 0.6.0 --- requirements/base.txt | 2 +- requirements/ci.txt | 2 +- requirements/dev.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 952c39f0..75226254 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -242,7 +242,7 @@ mozilla-django-oidc-db==0.21.1 # via # -r requirements/base.in # open-api-framework -notifications-api-common==0.4.0 +notifications-api-common==0.6.0 # via # -r requirements/base.in # commonground-api-common diff --git a/requirements/ci.txt b/requirements/ci.txt index 046fba01..01ed0f33 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -484,7 +484,7 @@ multidict==6.0.5 # via yarl mypy-extensions==1.0.0 # via black -notifications-api-common==0.4.0 +notifications-api-common==0.6.0 # via # -c requirements/base.txt # -r requirements/base.txt diff --git a/requirements/dev.txt b/requirements/dev.txt index 12bdcec1..ea2c5dba 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -566,7 +566,7 @@ mypy-extensions==1.0.0 # -c requirements/ci.txt # -r requirements/ci.txt # black -notifications-api-common==0.4.0 +notifications-api-common==0.6.0 # via # -c requirements/ci.txt # -r requirements/ci.txt From b640b287843df08247ffb49d4c7e9d4c3f0d6f81 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 17 Feb 2025 12:52:50 +0100 Subject: [PATCH 4/8] :arrow_up: [#521] Upgrade mozilla-django-oidc-db to 0.22.0 --- requirements/base.txt | 2 +- requirements/ci.txt | 2 +- requirements/dev.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 75226254..456cb0b4 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -238,7 +238,7 @@ maykin-2fa==1.0.1 # via open-api-framework mozilla-django-oidc==4.0.0 # via mozilla-django-oidc-db -mozilla-django-oidc-db==0.21.1 +mozilla-django-oidc-db==0.22.0 # via # -r requirements/base.in # open-api-framework diff --git a/requirements/ci.txt b/requirements/ci.txt index 01ed0f33..84436b1a 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -475,7 +475,7 @@ mozilla-django-oidc==4.0.0 # -c requirements/base.txt # -r requirements/base.txt # mozilla-django-oidc-db -mozilla-django-oidc-db==0.21.1 +mozilla-django-oidc-db==0.22.0 # via # -c requirements/base.txt # -r requirements/base.txt diff --git a/requirements/dev.txt b/requirements/dev.txt index ea2c5dba..eccd2f4c 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -551,7 +551,7 @@ mozilla-django-oidc==4.0.0 # -c requirements/ci.txt # -r requirements/ci.txt # mozilla-django-oidc-db -mozilla-django-oidc-db==0.21.1 +mozilla-django-oidc-db==0.22.0 # via # -c requirements/ci.txt # -r requirements/ci.txt From 0494098451cb43cf0e693dc9ebbfbd170900a6cb Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 17 Feb 2025 13:06:45 +0100 Subject: [PATCH 5/8] :memo: [#521] Update docs for setup-config --- docs/conf.py | 14 + docs/installation/config_cli.rst | 239 ++++-------------- .../setup_configuration/models/token_auth.py | 29 ++- .../setup_configuration/steps/objecttypes.py | 8 + .../setup_configuration/steps/token_auth.py | 4 + 5 files changed, 100 insertions(+), 194 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index fc2a50ef..d67ee901 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -8,9 +8,16 @@ import os import sys +import django +from django.utils.translation import activate + sys.path.insert(0, os.path.abspath("../src")) import objects # noqa isort:skip +from objects.setup import setup_env # noqa isort:skip + +setup_env() +django.setup() # from objects.setup import setup_env # noqa isort:skip @@ -41,6 +48,9 @@ "sphinx.ext.todo", "sphinx_tabs.tabs", "recommonmark", + "sphinx.ext.autodoc", + "django_setup_configuration.documentation.setup_config_example", + "django_setup_configuration.documentation.setup_config_usage", # "sphinx_markdown_tables", ] @@ -54,6 +64,10 @@ # Usually you set "language" from the command line for these cases. language = "en" +# Also set the language to English for Django, to make sure that any translatable text +# is also shown in English (for instance the help texts for setup configuration examples) +activate("en") + # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. diff --git a/docs/installation/config_cli.rst b/docs/installation/config_cli.rst index 9bc29555..b7465c12 100644 --- a/docs/installation/config_cli.rst +++ b/docs/installation/config_cli.rst @@ -5,216 +5,73 @@ Configuration (CLI) =================== -After deploying Objecttypes API and Objects API, they need to be configured to be fully functional. The -command line tool `setup_configuration`_ assist with this configuration: - -You can get the full command documentation with: - -.. code-block:: bash - - src/manage.py setup_configuration --help - -.. warning:: This command is declarative - if configuration is manually changed after - running the command and you then run the exact same command again, the manual - changes will be reverted. - -.. _`setup_configuration`: https://github.com/maykinmedia/django-setup-configuration/ - -Preparation -=========== - -The command executes the list of pluggable configuration steps, and each step -requires specific configuration information, that should be prepared. -Here is the description of all available configuration steps and the configuration -format, use by each step. +.. setup-config-usage:: + :show_command_usage: true + :show_steps: false + :show_steps_toc: false + :show_steps_autodoc: false Objects API =========== -Objecttypes configuration -------------------------- - -To configure objecttypes the following configuration could be used: - -.. code-block:: yaml - - zgw_consumers_config_enable: true - zgw_consumers: - services: - - identifier: objecttypen-foo - label: Objecttypen API Foo - api_root: http://objecttypen.foo/api/v1/ - api_type: orc - auth_type: api_key - header_key: Authorization - header_value: Token ba9d233e95e04c4a8a661a27daffe7c9bd019067 - - - identifier: objecttypen-bar - label: Objecttypen API Bar - api_root: http://objecttypen.bar/api/v1/ - api_type: orc - auth_type: api_key - header_key: Authorization - header_value: Token b9f100590925b529664ed9d370f5f8da124b2c20 - - objecttypes_config_enable: true - objecttypes: - items: - - uuid: b427ef84-189d-43aa-9efd-7bb2c459e281 - name: Object Type 1 - service_identifier: objecttypen-foo - - - uuid: b0e8553f-8b1a-4d55-ab90-6d02f1bcf2c2 - name: Object Type 2 - service_identifier: objecttypen-bar - ... - -.. note:: The ``uuid`` field will be used to lookup existing ``ObjectType``'s. - -Objecttypes require a corresponding ``Service`` to work correctly. Creating -these ``Service``'s can be done by defining these in the same yaml file. ``Service`` -instances will be created before the ``ObjectType``'s are created. - -Objecttypes connection configuration ------------------------------------- - -In order to be able to retrieve objecttypes, a corresponding ``Service`` should be -created. An example of a configuration could be seen below: +.. setup-config-usage:: + :show_command_usage: false -.. code-block:: yaml - - zgw_consumers_config_enable: true - zgw_consumers: - services: - - identifier: objecttypes-api-1 - label: Objecttypes API 1 - api_root: http://objecttypes-1.local/api/v1/ - api_connection_check_path: objecttypes - api_type: orc - auth_type: api_key - header_key: Authorization - header_value: Token ba9d233e95e04c4a8a661a27daffe7c9bd019067 - - identifier: objecttypes-api-2 - label: Objecttypes API 2 - api_root: http://objecttypes-2.local/api/v1/ - api_connection_check_path: objecttypes - api_type: orc - auth_type: api_key - header_key: Authorization - header_value: Token b9f100590925b529664ed9d370f5f8da124b2c20 - - -Tokens configuration --------------------- -Create or update the (single) YAML configuration file with your settings: - -.. code-block:: yaml +Objecttypes API +=============== - tokenauth_config_enable: true - tokenauth: - items: - - identifier: token-1 - token: ba9d233e95e04c4a8a661a27daffe7c9bd019067 - contact_person: Person 1 - email: person-1@example.com - organization: Organization XYZ # optional - application: Application XYZ # optional - administration: Administration XYZ # optional - permissions: - - object_type: b427ef84-189d-43aa-9efd-7bb2c459e281 - mode: read_and_write - - - identifier: token-2 - token: 7b2b212d9f16d171a70a1d927cdcfbd5ca7a4799 - contact_person: Person 2 - email: person-2@example.com - permissions: - - object_type: b0e8553f-8b1a-4d55-ab90-6d02f1bcf2c2 - mode: read_only - use_fields: true - fields: - '1': - - record__data__leeftijd - - record__data__kiemjaar - -.. note:: To ensure the proper functioning of the tokens, it is essential to first configure the ``objecttypes``. - Then, the token configuration must be completed to guarantee the correct configuration of the ``Permissions``. - - -Mozilla-django-oidc-db ----------------------- - -Create or update the (single) YAML configuration file with your settings: +.. FIXME these can currently only be included manually, because these docs are built in +.. the objects API repo -.. code-block:: yaml +.. autoclass:: django_setup_configuration.contrib.sites.steps.SitesConfigurationStep + :noindex: +.. setup-config-example:: django_setup_configuration.contrib.sites.steps.SitesConfigurationStep - oidc_db_config_enable: true - oidc_db_config_admin_auth: - items: - - identifier: admin-oidc - oidc_rp_client_id: client-id - oidc_rp_client_secret: secret - endpoint_config: - oidc_op_authorization_endpoint: https://example.com/realms/test/protocol/openid-connect/auth - oidc_op_token_endpoint: https://example.com/realms/test/protocol/openid-connect/token - oidc_op_user_endpoint: https://example.com/realms/test/protocol/openid-connect/userinfo +.. autoclass:: mozilla_django_oidc_db.setup_configuration.steps.AdminOIDCConfigurationStep + :noindex: +.. setup-config-example:: mozilla_django_oidc_db.setup_configuration.steps.AdminOIDCConfigurationStep - # workaround for https://github.com/maykinmedia/django-setup-configuration/issues/27 - userinfo_claims_source: id_token -More details about configuring mozilla-django-oidc-db through ``setup_configuration`` -can be found at the _`documentation`: https://mozilla-django-oidc-db.readthedocs.io/en/latest/setup_configuration.html. +**objecttypes.setup_configuration.steps.token_auth.TokenAuthConfigurationStep** +------------------------------------------------------------------------------- -Sites configuration -------------------- +Configure tokens with permissions for other applications to access Objectstypes API .. code-block:: yaml - sites_config_enable: true - sites_config: - items: - - domain: example.com - name: Example site - - domain: test.example.com - name: Test site + tokenauth_config_enable: true + tokenauth: -More details about sites configuration through ``setup_configuration`` -can be found at the _`site documentation`: https://github.com/maykinmedia/django-setup-configuration/blob/main/docs/sites_config.rst - - -Notifications configuration ---------------------------- - -To configure sending notifications for the application ensure there is a ``services`` -item present that matches the ``notifications_api_service_identifier`` in the -``notifications_config`` namespace: - -.. code-block:: yaml + # REQUIRED: true + items: + - - zgw_consumers_config_enable: true - zgw_consumers: - services: - - identifier: notifications-api - label: Notificaties API - api_root: http://notificaties.local/api/v1/ - api_connection_check_path: notificaties - api_type: nrc - auth_type: api_key + # DESCRIPTION: A human-friendly label to refer to this token + # REQUIRED: true + identifier: objects-api - notifications_config_enable: true - notifications_config: - notifications_api_service_identifier: notifications-api - notification_delivery_max_retries: 1 - notification_delivery_retry_backoff: 2 - notification_delivery_retry_backoff_max: 3 + # REQUIRED: true + token: modify-this -Execution -========= + # DESCRIPTION: Name of the person in the organization who can access the API + # REQUIRED: true + contact_person: example_string + # DESCRIPTION: Email of the person, who can access the API + # REQUIRED: true + email: example_string -With the full command invocation, everything is configured at once and immediately -tested. + # DESCRIPTION: Organization which has access to the API + # DEFAULT VALUE: "" + # REQUIRED: false + organization: example_string -.. code-block:: bash + # DESCRIPTION: Application which has access to the API + # DEFAULT VALUE: "" + # REQUIRED: false + application: example_string - src/manage.py setup_configuration --yaml-file /path/to/config.yaml + # DESCRIPTION: Administration which has access to the API + # DEFAULT VALUE: "" + # REQUIRED: false + administration: example_string diff --git a/src/objects/setup_configuration/models/token_auth.py b/src/objects/setup_configuration/models/token_auth.py index 23fae8f0..7ae4ff6b 100644 --- a/src/objects/setup_configuration/models/token_auth.py +++ b/src/objects/setup_configuration/models/token_auth.py @@ -6,9 +6,19 @@ class TokenAuthPermissionConfigurationModel(ConfigurationModel): - object_type: UUID4 + object_type: UUID4 = Field( + description="The UUID of the objecttype for which permission will be configured for this token." + ) fields: dict[str, list[str]] | None = DjangoModelRef( - Permission, "fields", default=None + Permission, + "fields", + default=None, + examples=[{"1": ["record__data__leeftijd", "record__data__kiemjaar"]}], + description=( + "The fields to which this token has access (field-based authorization). " + "Note that this can only be specified if the permission mode is `read_only` " + "and use_fields is set to `true`." + ), ) class Meta: @@ -18,11 +28,16 @@ class Meta: "use_fields", ), } + extra_kwargs = { + "use_fields": { + "examples": [True], + }, + } class TokenAuthConfigurationModel(ConfigurationModel): permissions: list[TokenAuthPermissionConfigurationModel] | None = Field( - default_factory=list, + default_factory=list, description="List of permissions for this token." ) class Meta: @@ -38,6 +53,14 @@ class Meta: "is_superuser", ) } + extra_kwargs = { + "identifier": { + "examples": ["application-name"], + }, + "token": { + "examples": ["modify-this"], + }, + } class TokenAuthGroupConfigurationModel(ConfigurationModel): diff --git a/src/objects/setup_configuration/steps/objecttypes.py b/src/objects/setup_configuration/steps/objecttypes.py index 91914ac4..75ffddf4 100644 --- a/src/objects/setup_configuration/steps/objecttypes.py +++ b/src/objects/setup_configuration/steps/objecttypes.py @@ -10,6 +10,14 @@ class ObjectTypesConfigurationStep(BaseConfigurationStep): + """ + Configure references to objecttypes in the Objecttypes API. + + .. note:: Note that these objecttypes references should match instances in the Objecttypes API. Currently + there is no configuration step to do this automatically, so these have to be configured + manually or by loading fixtures. + """ + config_model = ObjectTypesConfigurationModel verbose_name = "Objecttypes Configuration" diff --git a/src/objects/setup_configuration/steps/token_auth.py b/src/objects/setup_configuration/steps/token_auth.py index abe41e2b..5b0be199 100644 --- a/src/objects/setup_configuration/steps/token_auth.py +++ b/src/objects/setup_configuration/steps/token_auth.py @@ -21,6 +21,10 @@ class TokenAuthConfigurationStep( ): """ Configure tokens with permissions for other applications to access Objects API + + .. note:: To ensure the proper functioning of the tokens, it is essential to first + configure the ``objecttypes``. Then, the token configuration must be completed + to guarantee the correct configuration of the ``Permissions``. """ namespace = "tokenauth" From ee5a75f4c43edd965405daa72d260e794675cee5 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 17 Feb 2025 13:52:12 +0100 Subject: [PATCH 6/8] :alien: [#521] Fix ObjectsKanaal.get_kenmerken for new lib version get_kenmerken now has a request argument --- src/objects/api/kanalen.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/objects/api/kanalen.py b/src/objects/api/kanalen.py index a191a18b..8c6160d4 100644 --- a/src/objects/api/kanalen.py +++ b/src/objects/api/kanalen.py @@ -4,6 +4,7 @@ from django.db import models from notifications_api_common.kanalen import KANAAL_REGISTRY, Kanaal +from rest_framework.request import Request from objects.core.models import ObjectRecord @@ -22,7 +23,12 @@ def __init__( KANAAL_REGISTRY.add(self) - def get_kenmerken(self, obj: models.Model, data: dict = None) -> dict: + def get_kenmerken( + self, + obj: models.Model, + data: dict = None, + request: Request | None = None, # noqa + ) -> dict: data = data or {} return { kenmerk: ( From 9b6dabdadbd1fd3854b50800a6d9da9f46632bda Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 17 Feb 2025 13:53:08 +0100 Subject: [PATCH 7/8] :white_check_mark: [#521] Fix tests for changed setup-configuration behavior changes are now rolled back on failure in a step, so some assertions were no longer correct --- src/objects/core/tests/test_objecttype_config.py | 3 ++- .../setup_configuration/tests/test_token_auth_config.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/objects/core/tests/test_objecttype_config.py b/src/objects/core/tests/test_objecttype_config.py index 5fb40bb5..94d3848e 100644 --- a/src/objects/core/tests/test_objecttype_config.py +++ b/src/objects/core/tests/test_objecttype_config.py @@ -126,7 +126,8 @@ def test_invalid_uuid(self): objecttype.refresh_from_db() self.assertEqual(str(objecttype.uuid), "b427ef84-189d-43aa-9efd-7bb2c459e281") - self.assertEqual(objecttype._name, "Object Type 1") + # Name should not be changed, because the error causes a rollback + self.assertEqual(objecttype._name, "Object Type 001") self.assertEqual(objecttype.service, service) def test_idempotent_step(self): diff --git a/src/objects/setup_configuration/tests/test_token_auth_config.py b/src/objects/setup_configuration/tests/test_token_auth_config.py index 4fd20949..16a5eb49 100644 --- a/src/objects/setup_configuration/tests/test_token_auth_config.py +++ b/src/objects/setup_configuration/tests/test_token_auth_config.py @@ -348,7 +348,8 @@ def test_invalid_setup_token_unique(self): self.assertTrue( "Failed configuring token token-2" in str(command_error.exception) ) - self.assertEqual(TokenAuth.objects.count(), 1) + # Token was not created, because the changes are rolled back + self.assertEqual(TokenAuth.objects.count(), 0) def test_invalid_setup_contact_person(self): object_source = { @@ -724,8 +725,8 @@ def test_invalid_permissions_object_type_does_not_exist(self): "Object type with 69feca90-6c3d-4628-ace8-19e4b0ae4065 does not exist" in str(command_error.exception) ) - # Token was created without permissions - self.assertEqual(TokenAuth.objects.count(), 1) + # Token was not created, because the changes are rolled back + self.assertEqual(TokenAuth.objects.count(), 0) self.assertEqual(Permission.objects.count(), 0) def test_invalid_permissions_mode_not_valid(self): From 395ffaf5bf2d591b5e42ef8fc9633b87a4d4bdef Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 17 Feb 2025 13:54:34 +0100 Subject: [PATCH 8/8] :wrench: [#521] Install gdal packages in readthedocs build because django.setup is run when building documentation now, we need to have these packages installed as well because we use postgis --- .github/workflows/ci.yml | 3 ++- .readthedocs.yaml | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b016cc60..55eb4174 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,11 +86,12 @@ jobs: id: image-name open-api-ci: - uses: maykinmedia/open-api-workflows/.github/workflows/ci.yml@v3.0.2 + uses: maykinmedia/open-api-workflows/.github/workflows/ci.yml@v4.1.0 needs: - store-reusable-workflow-vars with: main-branch: 'master' + apt-packages: 'libgdal-dev gdal-bin' run-docs: true django-settings-module: objects.conf.ci python-version: '3.11' diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 5619e15d..cca082f1 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -8,12 +8,14 @@ sphinx: configuration: docs/conf.py build: - os: 'ubuntu-20.04' + os: 'ubuntu-22.04' apt_packages: - libxml2-dev - libxmlsec1-dev - libxmlsec1-openssl - wget + - libgdal-dev + - gdal-bin tools: python: '3.11'