From 4fab1ef93eb1652c7aa3162a43f77fb403001c9c Mon Sep 17 00:00:00 2001 From: Paul Schilling Date: Mon, 16 Dec 2024 16:09:16 +0100 Subject: [PATCH] [#2940] Add OpenKlant2 configuration model --- .../accounts/tests/test_profile_views.py | 102 +++++++++++++++++- src/open_inwoner/accounts/views/signals.py | 5 +- .../cms/cases/tests/test_contactform.py | 39 ++++++- .../migrations/0015_openklant2config.py | 70 ++++++++++++ ...g_openklant2config_zgw_service_and_more.py | 53 +++++++++ src/open_inwoner/openklant/models.py | 88 ++++++++------- src/open_inwoner/openklant/services.py | 6 +- .../tests/test_openklant2_service.py | 81 ++++++++++++-- .../openzaak/tests/test_case_detail.py | 39 ++++++- src/openklant2/_resources/actor.py | 2 +- src/openklant2/_resources/betrokkene.py | 2 +- src/openklant2/_resources/digitaal_adres.py | 2 +- src/openklant2/_resources/interne_taak.py | 2 +- src/openklant2/_resources/klant_contact.py | 2 +- src/openklant2/_resources/onderwerp_object.py | 2 +- src/openklant2/_resources/partij.py | 2 +- .../_resources/partij_identificator.py | 2 +- 17 files changed, 432 insertions(+), 67 deletions(-) create mode 100644 src/open_inwoner/openklant/migrations/0015_openklant2config.py create mode 100644 src/open_inwoner/openklant/migrations/0016_rename_service_config_openklant2config_zgw_service_and_more.py diff --git a/src/open_inwoner/accounts/tests/test_profile_views.py b/src/open_inwoner/accounts/tests/test_profile_views.py index a82f85ed87..d7dd40f1da 100644 --- a/src/open_inwoner/accounts/tests/test_profile_views.py +++ b/src/open_inwoner/accounts/tests/test_profile_views.py @@ -13,7 +13,11 @@ import requests_mock from django_webtest import WebTest from pyquery import PyQuery as PQ +from simple_certmanager.constants import CertificateTypes +from simple_certmanager.models import Certificate from webtest import Upload +from zgw_consumers.constants import APITypes +from zgw_consumers.models import Service from open_inwoner.accounts.choices import NotificationChannelChoice, StatusChoices from open_inwoner.accounts.signals import update_user_from_klant_on_login @@ -22,7 +26,7 @@ from open_inwoner.haalcentraal.tests.mixins import HaalCentraalMixin from open_inwoner.laposta.models import LapostaConfig from open_inwoner.laposta.tests.factories import LapostaListFactory, MemberFactory -from open_inwoner.openklant.models import OpenKlantConfig +from open_inwoner.openklant.models import OpenKlant2Config, OpenKlantConfig from open_inwoner.pdc.tests.factories import CategoryFactory from open_inwoner.plans.tests.factories import PlanFactory from open_inwoner.qmatic.tests.data import QmaticMockData @@ -62,6 +66,8 @@ ) class ProfileViewTests(WebTest): def setUp(self): + signals.user_logged_in.disconnect(update_user_from_klant_on_login) + self.url = reverse("profile:detail") self.return_url = reverse("logout") self.user = UserFactory( @@ -84,6 +90,36 @@ def setUp(self): ) cms_tools.create_apphook_page(ProfileApphook) + server_certificate, _ = Certificate.objects.get_or_create( + label="test-server-cert", + defaults={ + "type": CertificateTypes.cert_only, + }, + ) + zgw_service, _ = Service.objects.update_or_create( + api_root="http://localhost:8338/klantinteracties/api/v1", + defaults={ + "label": "Klanten API service", + "slug": "klanten-api-service", + "api_type": APITypes.kc, + "oas": "", + "auth_type": "", + "client_id": "", + "secret": "", + "user_id": "", + "user_representation": "", + "server_certificate": server_certificate, + }, + ) + self.openklant2_config = OpenKlant2Config.objects.create( + zgw_service=zgw_service, + mijn_vragen_kanaal="oip_mijn_vragen", + mijn_vragen_organisatie_naam="Open Inwoner Platform", + mijn_vragen_actor="ca0783a1-1d74-4e07-b3e0-185b1d2fccd4", + interne_taak_gevraagde_handeling="Beantwoorden vraag Mijn Omgeving", + interne_taak_toelichting="Beantwoorden vraag", + ) + def test_login_required(self): login_url = reverse("login") response = self.app.get(self.url) @@ -750,8 +786,40 @@ class ProfileDeleteTest(WebTest): @classmethod def setUpTestData(cls): + signals.user_logged_in.disconnect(update_user_from_klant_on_login) + cls.url = reverse("profile:detail") + server_certificate, _ = Certificate.objects.get_or_create( + label="test-server-cert", + defaults={ + "type": CertificateTypes.cert_only, + }, + ) + zgw_service, _ = Service.objects.update_or_create( + api_root="http://localhost:8338/klantinteracties/api/v1", + defaults={ + "label": "Klanten API service", + "slug": "klanten-api-service", + "api_type": APITypes.kc, + "oas": "", + "auth_type": "", + "client_id": "", + "secret": "", + "user_id": "", + "user_representation": "", + "server_certificate": server_certificate, + }, + ) + cls.openklant2_config = OpenKlant2Config.objects.create( + zgw_service=zgw_service, + mijn_vragen_kanaal="oip_mijn_vragen", + mijn_vragen_organisatie_naam="Open Inwoner Platform", + mijn_vragen_actor="ca0783a1-1d74-4e07-b3e0-185b1d2fccd4", + interne_taak_gevraagde_handeling="Beantwoorden vraag Mijn Omgeving", + interne_taak_toelichting="Beantwoorden vraag", + ) + def test_delete_regular_user_success(self): user = UserFactory() @@ -986,6 +1054,38 @@ def test_preselected_values(self): @override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls") @patch("open_inwoner.cms.utils.page_display._is_published", return_value=True) class EditNotificationsTests(AssertTimelineLogMixin, WebTest): + @classmethod + def setUpTestData(cls): + server_certificate, _ = Certificate.objects.get_or_create( + label="test-server-cert", + defaults={ + "type": CertificateTypes.cert_only, + }, + ) + zgw_service, _ = Service.objects.update_or_create( + api_root="http://localhost:8338/klantinteracties/api/v1", + defaults={ + "label": "Klanten API service", + "slug": "klanten-api-service", + "api_type": APITypes.kc, + "oas": "", + "auth_type": "", + "client_id": "", + "secret": "", + "user_id": "", + "user_representation": "", + "server_certificate": server_certificate, + }, + ) + cls.openklant2_config = OpenKlant2Config.objects.create( + zgw_service=zgw_service, + mijn_vragen_kanaal="oip_mijn_vragen", + mijn_vragen_organisatie_naam="Open Inwoner Platform", + mijn_vragen_actor="ca0783a1-1d74-4e07-b3e0-185b1d2fccd4", + interne_taak_gevraagde_handeling="Beantwoorden vraag Mijn Omgeving", + interne_taak_toelichting="Beantwoorden vraag", + ) + def setUp(self): self.config = SiteConfiguration.get_solo() self.config.notifications_messages_enabled = True diff --git a/src/open_inwoner/accounts/views/signals.py b/src/open_inwoner/accounts/views/signals.py index 0381d09d8b..f806a8ffc1 100644 --- a/src/open_inwoner/accounts/views/signals.py +++ b/src/open_inwoner/accounts/views/signals.py @@ -1,6 +1,5 @@ import logging -from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver @@ -23,9 +22,7 @@ def get_or_create_klant_for_new_user( user = instance # OpenKlant2 - # TODO: replace with proper config and refactor branching - use_ok2 = getattr(settings, "OPENKLANT2_CONFIG", None) - if use_ok2 and (openklant2_config := OpenKlant2Config.from_django_settings()): + if openklant2_config := OpenKlant2Config.get_solo(): try: service = OpenKlant2Service(config=openklant2_config) except RuntimeError: diff --git a/src/open_inwoner/cms/cases/tests/test_contactform.py b/src/open_inwoner/cms/cases/tests/test_contactform.py index ef045769a5..2f3275960d 100644 --- a/src/open_inwoner/cms/cases/tests/test_contactform.py +++ b/src/open_inwoner/cms/cases/tests/test_contactform.py @@ -1,6 +1,7 @@ from unittest.mock import ANY, patch from django.conf import settings +from django.contrib.auth.signals import user_logged_in from django.core import mail from django.test import override_settings from django.urls import reverse @@ -8,19 +9,23 @@ import requests_mock from django_webtest import WebTest +from simple_certmanager.constants import CertificateTypes +from simple_certmanager.models import Certificate from zgw_consumers.api_models.constants import ( RolOmschrijving, RolTypes, VertrouwelijkheidsAanduidingen, ) from zgw_consumers.constants import APITypes +from zgw_consumers.models import Service +from open_inwoner.accounts.signals import update_user_from_klant_on_login from open_inwoner.accounts.tests.factories import ( DigidUserFactory, eHerkenningUserFactory, ) from open_inwoner.openklant.constants import Status -from open_inwoner.openklant.models import OpenKlantConfig +from open_inwoner.openklant.models import OpenKlant2Config, OpenKlantConfig from open_inwoner.openklant.services import eSuiteVragenService from open_inwoner.openklant.tests.data import CONTACTMOMENTEN_ROOT, KLANTEN_ROOT from open_inwoner.openzaak.models import CatalogusConfig, OpenZaakConfig @@ -62,6 +67,38 @@ class CasesContactFormTestCase(AssertMockMatchersMixin, ClearCachesMixin, WebTes def setUp(self): super().setUp() + user_logged_in.disconnect(update_user_from_klant_on_login) + + server_certificate, _ = Certificate.objects.get_or_create( + label="test-server-cert", + defaults={ + "type": CertificateTypes.cert_only, + }, + ) + zgw_service, _ = Service.objects.update_or_create( + api_root="http://localhost:8338/klantinteracties/api/v1", + defaults={ + "label": "Klanten API service", + "slug": "klanten-api-service", + "api_type": APITypes.kc, + "oas": "", + "auth_type": "", + "client_id": "", + "secret": "", + "user_id": "", + "user_representation": "", + "server_certificate": server_certificate, + }, + ) + self.openklant2_config = OpenKlant2Config.objects.create( + zgw_service=zgw_service, + mijn_vragen_kanaal="oip_mijn_vragen", + mijn_vragen_organisatie_naam="Open Inwoner Platform", + mijn_vragen_actor="ca0783a1-1d74-4e07-b3e0-185b1d2fccd4", + interne_taak_gevraagde_handeling="Beantwoorden vraag Mijn Omgeving", + interne_taak_toelichting="Beantwoorden vraag", + ) + self.user = DigidUserFactory(bsn="900222086") # services diff --git a/src/open_inwoner/openklant/migrations/0015_openklant2config.py b/src/open_inwoner/openklant/migrations/0015_openklant2config.py new file mode 100644 index 0000000000..62bcf8938b --- /dev/null +++ b/src/open_inwoner/openklant/migrations/0015_openklant2config.py @@ -0,0 +1,70 @@ +# Generated by Django 4.2.16 on 2024-12-16 15:09 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("zgw_consumers", "0022_set_default_service_slug"), + ("openklant", "0014_contactformconfig"), + ] + + operations = [ + migrations.CreateModel( + name="OpenKlant2Config", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "mijn_vragen_kanaal", + models.CharField(blank=True, verbose_name="Mijn vragen kanaal"), + ), + ( + "mijn_vragen_organisatie_naam", + models.CharField( + blank=True, verbose_name="Mijn vragen organisatie naam" + ), + ), + ( + "mijn_vragen_actor", + models.CharField(blank=True, verbose_name="Mijn vragen actor"), + ), + ( + "interne_taak_gevraagde_handeling", + models.CharField( + blank=True, verbose_name="Interne taak gevraagde handeling" + ), + ), + ( + "interne_taak_toelichting", + models.CharField( + blank=True, verbose_name="Interne taak toelichting" + ), + ), + ( + "service_config", + models.OneToOneField( + blank=True, + limit_choices_to={"api_type": "kc"}, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="zgw_consumers.service", + verbose_name="Klanten API", + ), + ), + ], + options={ + "verbose_name": "Open Klant configuration", + }, + ), + ] diff --git a/src/open_inwoner/openklant/migrations/0016_rename_service_config_openklant2config_zgw_service_and_more.py b/src/open_inwoner/openklant/migrations/0016_rename_service_config_openklant2config_zgw_service_and_more.py new file mode 100644 index 0000000000..cad1da3b8b --- /dev/null +++ b/src/open_inwoner/openklant/migrations/0016_rename_service_config_openklant2config_zgw_service_and_more.py @@ -0,0 +1,53 @@ +# Generated by Django 4.2.16 on 2024-12-17 07:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("openklant", "0015_openklant2config"), + ] + + operations = [ + migrations.RenameField( + model_name="openklant2config", + old_name="service_config", + new_name="zgw_service", + ), + migrations.AlterField( + model_name="openklant2config", + name="interne_taak_gevraagde_handeling", + field=models.CharField( + blank=True, default="", verbose_name="Interne taak gevraagde handeling" + ), + ), + migrations.AlterField( + model_name="openklant2config", + name="interne_taak_toelichting", + field=models.CharField( + blank=True, default="", verbose_name="Interne taak toelichting" + ), + ), + migrations.AlterField( + model_name="openklant2config", + name="mijn_vragen_actor", + field=models.CharField( + blank=True, default="", verbose_name="Mijn vragen actor" + ), + ), + migrations.AlterField( + model_name="openklant2config", + name="mijn_vragen_kanaal", + field=models.CharField( + blank=True, default="", verbose_name="Mijn vragen kanaal" + ), + ), + migrations.AlterField( + model_name="openklant2config", + name="mijn_vragen_organisatie_naam", + field=models.CharField( + blank=True, default="", verbose_name="Mijn vragen organisatie naam" + ), + ), + ] diff --git a/src/open_inwoner/openklant/models.py b/src/open_inwoner/openklant/models.py index c1d0029910..46a94bfd41 100644 --- a/src/open_inwoner/openklant/models.py +++ b/src/open_inwoner/openklant/models.py @@ -1,9 +1,3 @@ -import uuid -from dataclasses import dataclass -from typing import Self -from urllib.parse import urljoin, urlparse, urlunparse - -from django.core.exceptions import ImproperlyConfigured from django.db import models from django.utils.translation import gettext_lazy as _ @@ -138,6 +132,54 @@ def has_api_configuration(self): return all(getattr(self, f, "") for f in self.register_api_required_fields) +class OpenKlant2ConfigManager(models.Manager): + def get_queryset(self): + qs = super().get_queryset() + return qs.select_related("service_config") + + +class OpenKlant2Config(SingletonModel): + zgw_service = models.OneToOneField( + "zgw_consumers.Service", + verbose_name=_("Klanten API"), + on_delete=models.PROTECT, + limit_choices_to={"api_type": APITypes.kc}, + related_name="+", + null=True, + blank=True, + ) + + # Vragen + mijn_vragen_kanaal = models.CharField( + verbose_name=_("Mijn vragen kanaal"), + default="", + blank=True, + ) + mijn_vragen_organisatie_naam = models.CharField( + verbose_name=_("Mijn vragen organisatie naam"), + default="", + blank=True, + ) + mijn_vragen_actor = models.CharField( + verbose_name=_("Mijn vragen actor"), + default="", + blank=True, + ) + interne_taak_gevraagde_handeling = models.CharField( + verbose_name=_("Interne taak gevraagde handeling"), + default="", + blank=True, + ) + interne_taak_toelichting = models.CharField( + verbose_name=_("Interne taak toelichting"), + default="", + blank=True, + ) + + class Meta: + verbose_name = _("Open Klant configuration") + + class ContactFormSubject(OrderedModel): subject = models.CharField( verbose_name=_("Onderwerp"), @@ -190,37 +232,3 @@ class Meta: verbose_name = _("KlantContactMoment") verbose_name_plural = _("KlantContactMomenten") unique_together = [["user", "contactmoment_url"]] - - -@dataclass -class OpenKlant2Config: - api_root: str - api_path: str - api_token: str - - # Question/Answer settings - mijn_vragen_kanaal: str - mijn_vragen_organisatie_naam: str - mijn_vragen_actor: str | uuid.UUID | None - interne_taak_gevraagde_handeling: str - interne_taak_toelichting: str - - @property - def api_url(self): - joined = urljoin(self.api_root, self.api_path) - scheme, netloc, path, params, query, fragment = urlparse(joined) - path = path.replace("//", "/") - return urlunparse((scheme, netloc, path, params, query, fragment)) - - @classmethod - def from_django_settings(cls) -> Self: - from django.conf import settings - - if not (config := getattr(settings, "OPENKLANT2_CONFIG", None)): - raise ImproperlyConfigured( - "Please set OPENKLANT2_CONFIG in your settings to configure OpenKlant2" - ) - - return cls(**config) - - # TODO: add from_openklant_config_model or similar diff --git a/src/open_inwoner/openklant/services.py b/src/open_inwoner/openklant/services.py index d2dae1caa8..2ece5e03e9 100644 --- a/src/open_inwoner/openklant/services.py +++ b/src/open_inwoner/openklant/services.py @@ -823,16 +823,16 @@ class OpenKlant2Service(KlantenService): client: OpenKlant2Client def __init__(self, config: OpenKlant2Config | None = None): - self.config = config or OpenKlant2Config.from_django_settings() + self.config = config or OpenKlant2Config.get_solo() if not self.config: raise ImproperlyConfigured( "Please set OPENKLANT2_CONFIG in your settings to configure OpenKlant2" ) self.client = OpenKlant2Client( - base_url=self.config.api_url, + base_url=self.config.zgw_service.api_root, request_kwargs={ - "headers": {"Authorization": f"Token {self.config.api_token}"} + "headers": {"Authorization": f"Token {self.config.zgw_service.secret}"} }, ) diff --git a/src/open_inwoner/openklant/tests/test_openklant2_service.py b/src/open_inwoner/openklant/tests/test_openklant2_service.py index f9b8177a1e..788cefcd32 100644 --- a/src/open_inwoner/openklant/tests/test_openklant2_service.py +++ b/src/open_inwoner/openklant/tests/test_openklant2_service.py @@ -3,6 +3,10 @@ from django.test import tag import freezegun +from simple_certmanager.constants import CertificateTypes +from simple_certmanager.models import Certificate +from zgw_consumers.constants import APITypes +from zgw_consumers.models import Service from open_inwoner.accounts.models import User from open_inwoner.accounts.tests.factories import UserFactory @@ -17,10 +21,30 @@ class PartijGetOrCreateTestCase(Openklant2ServiceTestCase): def setUp(self): super().setUp() + + server_certificate, _ = Certificate.objects.get_or_create( + label="test-server-cert", + defaults={ + "type": CertificateTypes.cert_only, + }, + ) + zgw_service, _ = Service.objects.update_or_create( + api_root="http://localhost:8338/klantinteracties/api/v1", + defaults={ + "label": "Klanten API service", + "slug": "klanten-api-service", + "api_type": APITypes.kc, + "oas": "", + "auth_type": "", + "client_id": "", + "secret": "", + "user_id": "", + "user_representation": "", + "server_certificate": server_certificate, + }, + ) self.openklant2_config = OpenKlant2Config( - api_root=self.openklant2_api_root, - api_path=self.openklant2_api_path, - api_token=self.openklant2_api_token, + zgw_service=zgw_service, mijn_vragen_kanaal="oip_mijn_vragen", mijn_vragen_organisatie_naam="Open Inwoner Platform", mijn_vragen_actor="ca0783a1-1d74-4e07-b3e0-185b1d2fccd4", @@ -220,10 +244,30 @@ def test_get_or_create_organisatie_with_vestiging(self): class Openklant2ServiceTest(Openklant2ServiceTestCase): def setUp(self): super().setUp() + + server_certificate, _ = Certificate.objects.get_or_create( + label="test-server-cert", + defaults={ + "type": CertificateTypes.cert_only, + }, + ) + zgw_service, _ = Service.objects.update_or_create( + api_root="http://localhost:8338/klantinteracties/api/v1", + defaults={ + "label": "Klanten API service", + "slug": "klanten-api-service", + "api_type": APITypes.kc, + "oas": "", + "auth_type": "", + "client_id": "", + "secret": "", + "user_id": "", + "user_representation": "", + "server_certificate": server_certificate, + }, + ) self.openklant2_config = OpenKlant2Config( - api_root=self.openklant2_api_root, - api_path=self.openklant2_api_path, - api_token=self.openklant2_api_token, + zgw_service=zgw_service, mijn_vragen_kanaal="oip_mijn_vragen", mijn_vragen_organisatie_naam="Open Inwoner Platform", mijn_vragen_actor="ca0783a1-1d74-4e07-b3e0-185b1d2fccd4", @@ -360,10 +404,29 @@ def setUp(self): } ) + server_certificate, _ = Certificate.objects.get_or_create( + label="test-server-cert", + defaults={ + "type": CertificateTypes.cert_only, + }, + ) + zgw_service, _ = Service.objects.update_or_create( + api_root="http://localhost:8338/klantinteracties/api/v1", + defaults={ + "label": "Klanten API service", + "slug": "klanten-api-service", + "api_type": APITypes.kc, + "oas": "", + "auth_type": "", + "client_id": "", + "secret": "", + "user_id": "", + "user_representation": "", + "server_certificate": server_certificate, + }, + ) self.openklant2_config = OpenKlant2Config( - api_root=self.openklant2_api_root, - api_path=self.openklant2_api_path, - api_token=self.openklant2_api_token, + zgw_service=zgw_service, mijn_vragen_kanaal="oip_mijn_vragen", mijn_vragen_organisatie_naam="Open Inwoner Platform", mijn_vragen_actor=self.designated_actor["uuid"], diff --git a/src/open_inwoner/openzaak/tests/test_case_detail.py b/src/open_inwoner/openzaak/tests/test_case_detail.py index f1edaec850..777f6baa06 100644 --- a/src/open_inwoner/openzaak/tests/test_case_detail.py +++ b/src/open_inwoner/openzaak/tests/test_case_detail.py @@ -3,6 +3,7 @@ from django.conf import settings from django.contrib.auth.models import AnonymousUser +from django.contrib.auth.signals import user_logged_in from django.test import RequestFactory from django.test.utils import override_settings from django.urls import reverse @@ -13,6 +14,8 @@ from django_webtest import TransactionWebTest from freezegun import freeze_time from pyquery import PyQuery +from simple_certmanager.constants import CertificateTypes +from simple_certmanager.models import Certificate from timeline_logger.models import TimelineLog from webtest import Upload from webtest.forms import Hidden @@ -23,8 +26,10 @@ VertrouwelijkheidsAanduidingen, ) from zgw_consumers.constants import APITypes +from zgw_consumers.models import Service from open_inwoner.accounts.choices import LoginTypeChoices +from open_inwoner.accounts.signals import update_user_from_klant_on_login from open_inwoner.accounts.tests.factories import UserFactory, eHerkenningUserFactory from open_inwoner.cms.cases.views.status import InnerCaseDetailView, SimpleFile from open_inwoner.openklant.api_models import ObjectContactMoment @@ -32,7 +37,7 @@ KlantenServiceType, Status as ContactMomentStatus, ) -from open_inwoner.openklant.models import OpenKlantConfig +from open_inwoner.openklant.models import OpenKlant2Config, OpenKlantConfig from open_inwoner.openklant.services import eSuiteVragenService from open_inwoner.openklant.tests.factories import make_question_from_contactmoment from open_inwoner.openklant.tests.mocks import MockOpenKlant2Service @@ -88,6 +93,8 @@ class TestCaseDetailView( def setUp(self): super().setUp() + user_logged_in.disconnect(update_user_from_klant_on_login) + self.user = UserFactory( login_type=LoginTypeChoices.digid, bsn="900222086", email="johm@smith.nl" ) @@ -128,6 +135,36 @@ def setUp(self): self.openklant_config.contactmomenten_service = self.contactmoment_service self.openklant_config.save() + server_certificate, _ = Certificate.objects.get_or_create( + label="test-server-cert", + defaults={ + "type": CertificateTypes.cert_only, + }, + ) + zgw_service, _ = Service.objects.update_or_create( + api_root="http://localhost:8338/klantinteracties/api/v1", + defaults={ + "label": "Klanten API service", + "slug": "klanten-api-service", + "api_type": APITypes.kc, + "oas": "", + "auth_type": "", + "client_id": "", + "secret": "", + "user_id": "", + "user_representation": "", + "server_certificate": server_certificate, + }, + ) + self.openklant2_config = OpenKlant2Config.objects.create( + zgw_service=zgw_service, + mijn_vragen_kanaal="oip_mijn_vragen", + mijn_vragen_organisatie_naam="Open Inwoner Platform", + mijn_vragen_actor="ca0783a1-1d74-4e07-b3e0-185b1d2fccd4", + interne_taak_gevraagde_handeling="Beantwoorden vraag Mijn Omgeving", + interne_taak_toelichting="Beantwoorden vraag", + ) + self.case_detail_url = reverse( "cases:case_detail_content", kwargs={ diff --git a/src/openklant2/_resources/actor.py b/src/openklant2/_resources/actor.py index f48de99bfa..33b897ca94 100644 --- a/src/openklant2/_resources/actor.py +++ b/src/openklant2/_resources/actor.py @@ -10,7 +10,7 @@ class ActorResource(ResourceMixin): http_client: APIClient - base_path: str = "/actoren" + base_path: str = "actoren" def create( self, diff --git a/src/openklant2/_resources/betrokkene.py b/src/openklant2/_resources/betrokkene.py index bb1f7f066d..0dc97feea3 100644 --- a/src/openklant2/_resources/betrokkene.py +++ b/src/openklant2/_resources/betrokkene.py @@ -10,7 +10,7 @@ class BetrokkeneResource(ResourceMixin): http_client: APIClient - base_path: str = "/betrokkenen" + base_path: str = "betrokkenen" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/src/openklant2/_resources/digitaal_adres.py b/src/openklant2/_resources/digitaal_adres.py index 5bd78d0d71..ba87ce4f59 100644 --- a/src/openklant2/_resources/digitaal_adres.py +++ b/src/openklant2/_resources/digitaal_adres.py @@ -14,7 +14,7 @@ class DigitaalAdresResource(ResourceMixin): http_client: APIClient - base_path: str = "/digitaleadressen" + base_path: str = "digitaleadressen" def list( self, *, params: ListDigitaalAdresParams | None = None diff --git a/src/openklant2/_resources/interne_taak.py b/src/openklant2/_resources/interne_taak.py index efa92a274a..5c605a617c 100644 --- a/src/openklant2/_resources/interne_taak.py +++ b/src/openklant2/_resources/interne_taak.py @@ -10,7 +10,7 @@ class InterneTaakResource(ResourceMixin): http_client: APIClient - base_path: str = "/internetaken" + base_path: str = "internetaken" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/src/openklant2/_resources/klant_contact.py b/src/openklant2/_resources/klant_contact.py index cc99e93ffa..cb2a61fe12 100644 --- a/src/openklant2/_resources/klant_contact.py +++ b/src/openklant2/_resources/klant_contact.py @@ -15,7 +15,7 @@ class KlantContactResource(ResourceMixin): http_client: APIClient - base_path: str = "/klantcontacten" + base_path: str = "klantcontacten" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/src/openklant2/_resources/onderwerp_object.py b/src/openklant2/_resources/onderwerp_object.py index 4299db360b..e7ae95296d 100644 --- a/src/openklant2/_resources/onderwerp_object.py +++ b/src/openklant2/_resources/onderwerp_object.py @@ -14,7 +14,7 @@ class OnderwerpObjectResource(ResourceMixin): http_client: APIClient - base_path: str = "/onderwerpobjecten" + base_path: str = "onderwerpobjecten" def create( self, diff --git a/src/openklant2/_resources/partij.py b/src/openklant2/_resources/partij.py index c97cbe74e8..4016635211 100644 --- a/src/openklant2/_resources/partij.py +++ b/src/openklant2/_resources/partij.py @@ -17,7 +17,7 @@ class PartijResource(ResourceMixin): http_client: APIClient - base_path: str = "/partijen" + base_path: str = "partijen" def list( self, *, params: PartijListParams | None = None diff --git a/src/openklant2/_resources/partij_identificator.py b/src/openklant2/_resources/partij_identificator.py index 39f095b9b6..58d77e3755 100644 --- a/src/openklant2/_resources/partij_identificator.py +++ b/src/openklant2/_resources/partij_identificator.py @@ -14,7 +14,7 @@ class PartijIdentificatorResource(ResourceMixin): http_client: APIClient - base_path: str = "/partij-identificatoren" + base_path: str = "partij-identificatoren" def list( self, *, params: ListPartijIdentificatorenParams | None = None