diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/test_admin.py b/src/openforms/registrations/contrib/zgw_apis/tests/test_admin.py deleted file mode 100644 index 1bb0038486..0000000000 --- a/src/openforms/registrations/contrib/zgw_apis/tests/test_admin.py +++ /dev/null @@ -1,63 +0,0 @@ -from django.urls import reverse -from django.utils.translation import gettext as _ - -import requests -import requests_mock -from django_webtest import WebTest -from maykin_2fa.test import disable_admin_mfa -from zgw_consumers.api_models.constants import VertrouwelijkheidsAanduidingen - -from openforms.accounts.tests.factories import SuperUserFactory - -from .factories import ZGWApiGroupConfigFactory - - -@disable_admin_mfa() -class ZGWApiGroupConfigAdminTests(WebTest): - @requests_mock.Mocker() - def test_admin_while_services_are_down(self, m): - m.register_uri( - requests_mock.ANY, requests_mock.ANY, exc=requests.ConnectTimeout - ) - zgw_group = ZGWApiGroupConfigFactory.create( - zrc_service__api_root="https://zaken-1.nl/api/v1/", - zrc_service__oas="https://zaken-1.nl/api/v1/schema/openapi.yaml", - drc_service__api_root="https://documenten-1.nl/api/v1/", - drc_service__oas="https://documenten-1.nl/api/v1/schema/openapi.yaml", - ztc_service__api_root="https://catalogus-1.nl/api/v1/", - ztc_service__oas="https://catalogus-1.nl/api/v1/schema/openapi.yaml", - zaaktype="https://catalogi-1.nl/api/v1/zaaktypen/1", - informatieobjecttype="https://catalogi-1.nl/api/v1/informatieobjecttypen/1", - organisatie_rsin="000000000", - zaak_vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar, - ) - superuser = SuperUserFactory.create() - - response = self.app.get( - reverse("admin:zgw_apis_zgwapigroupconfig_change", args=(zgw_group.pk,)), - user=superuser, - ) - - self.assertEqual(response.status_code, 200) - form = response.forms["zgwapigroupconfig_form"] - self.assertEqual( - form["zaaktype"].value, "https://catalogi-1.nl/api/v1/zaaktypen/1" - ) - error_node = response.pyquery( - ".field-zaaktype .openforms-error-widget .openforms-error-widget__column small" - ) - self.assertEqual( - error_node.text(), - _( - "Could not load data - enable and check the request " - "logs for more details." - ), - ) - - with self.subTest("submitting form doesn't clear configuration"): - form.submit() - - zgw_group.refresh_from_db() - self.assertEqual( - zgw_group.zaaktype, "https://catalogi-1.nl/api/v1/zaaktypen/1" - ) diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/test_backend.py b/src/openforms/registrations/contrib/zgw_apis/tests/test_backend.py index 7372001617..c0585965b5 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/test_backend.py +++ b/src/openforms/registrations/contrib/zgw_apis/tests/test_backend.py @@ -1265,6 +1265,7 @@ def test_zgw_backend_default_author(self, m): zgw_form_options = dict( zgw_api_group=self.zgw_group, zaaktype="https://catalogi.nl/api/v1/zaaktypen/1", + informatieobjecttype="https://catalogi.nl/api/v1/informatieobjecttypen/1", ) self.install_mocks(m) @@ -1409,7 +1410,11 @@ def test_zgw_backend_has_reference_after_pre_submission(self, m): ) submission = SubmissionFactory.create( form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": self.zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": self.zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, completed_not_preregistered=True, ) assert submission.public_registration_reference == "" diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/test_models.py b/src/openforms/registrations/contrib/zgw_apis/tests/test_models.py index 49a4e5db84..57a225c303 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/test_models.py +++ b/src/openforms/registrations/contrib/zgw_apis/tests/test_models.py @@ -4,39 +4,27 @@ from .factories import ZGWApiGroupConfigFactory -class ZGWBackendTests(TestCase): - def setUp(self): - self.config = ZGWApiGroupConfigFactory.create( +class ZGWApiGroupModelTests(TestCase): + @classmethod + def setUpTestData(cls): + config = ZGWApiGroupConfigFactory.create( zrc_service__api_root="https://zaken.nl/api/v1/", drc_service__api_root="https://documenten.nl/api/v1/", ztc_service__api_root="https://catalogus.nl/api/v1/", ) - self.config.full_clean() + config.full_clean() + cls.config = config def test_model_validate(self): - self.config.zaaktype = "https://catalogus.nl/api/v1/zaaktype/1" - self.config.informatieobjecttype = "https://catalogus.nl/api/v1/info/1" self.config.rsin = "619183020" self.config.full_clean() - def test_model_invalid_zaaktype(self): - with self.assertRaises(ValidationError): - self.config.zaaktype = "https://BAD_DOMAIN.nl/api/v1/zaak/1" - self.config.full_clean() - - def test_model_invalid_informatieobjecttype(self): - with self.assertRaises(ValidationError): - self.config.informatieobjecttype = "https://BAD_DOMAIN.nl/api/v1/info/1" - self.config.full_clean() - def test_model_invalid_rsin(self): with self.assertRaises(ValidationError): self.config.organisatie_rsin = "063-08836" self.config.full_clean() def test_model_string(self): - api_group = ZGWApiGroupConfigFactory.create( - name="ZGW API test", - ) + api_group = ZGWApiGroupConfigFactory.create(name="ZGW API test") self.assertEqual(str(api_group), "ZGW API test") diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/test_validators.py b/src/openforms/registrations/contrib/zgw_apis/tests/test_validators.py index 091923f3bf..cdfa735689 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/test_validators.py +++ b/src/openforms/registrations/contrib/zgw_apis/tests/test_validators.py @@ -44,6 +44,7 @@ def test_valid_omschrijving(self, m): data = { "zgw_api_group": self.zgw_group.pk, "zaaktype": "https://catalogus.nl/api/v1/zaaktypen/111", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", "medewerker_roltype": "Some description", } @@ -69,6 +70,7 @@ def test_invalid_omschrijving(self, m): data = { "zgw_api_group": self.zgw_group.pk, "zaaktype": "https://catalogus.nl/api/v1/zaaktypen/111", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", "medewerker_roltype": "Some description", } @@ -88,7 +90,12 @@ def test_invalid_omschrijving(self, m): class ZGWAPIGroupConfigTest(TestCase): def test_no_zgw_api_group_and_no_default(self): # No zgw_api_group provided - serializer = ZaakOptionsSerializer(data={}) + serializer = ZaakOptionsSerializer( + data={ + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + } + ) # No ZgwConfig.default_zgw_api_group configured with patch( @@ -111,8 +118,6 @@ def test_existing_provided_variable_in_specific_zaaktype(self, m): drc_service__api_root="https://documenten.nl/api/v1/", ztc_service__api_root="https://catalogus.nl/api/v1/", ) - zgw_group.zaaktype = "https://zaken.nl/api/v1/zaaktypen/1" - zgw_group.save() m.get( "https://catalogus.nl/api/v1/eigenschappen?zaaktype=https%3A%2F%2Fzaken.nl%2Fapi%2Fv1%2Fzaaktypen%2F1", status_code=200, @@ -143,6 +148,8 @@ def test_existing_provided_variable_in_specific_zaaktype(self, m): data = { "zgw_api_group": zgw_group.pk, + "zaaktype": "https://zaken.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", "property_mappings": [ {"component_key": "textField", "eigenschap": "a property name"} ], @@ -160,8 +167,6 @@ def test_provided_variable_does_not_exist_in_specific_zaaktype(self, m): drc_service__api_root="https://documenten.nl/api/v1/", ztc_service__api_root="https://catalogus.nl/api/v1/", ) - zgw_group.zaaktype = "https://zaken.nl/api/v1/zaaktypen/1" - zgw_group.save() m.get( "https://catalogus.nl/api/v1/eigenschappen?zaaktype=https%3A%2F%2Fzaken.nl%2Fapi%2Fv1%2Fzaaktypen%2F1", status_code=200, @@ -192,6 +197,8 @@ def test_provided_variable_does_not_exist_in_specific_zaaktype(self, m): data = { "zgw_api_group": zgw_group.pk, + "zaaktype": "https://zaken.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", "property_mappings": [ {"component_key": "textField", "eigenschap": "wrong variable"} ], diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/test_zgw_api_config.py b/src/openforms/registrations/contrib/zgw_apis/tests/test_zgw_api_config.py index b1126c73c0..3bacf1a146 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/test_zgw_api_config.py +++ b/src/openforms/registrations/contrib/zgw_apis/tests/test_zgw_api_config.py @@ -28,18 +28,14 @@ def setUpTestData(cls): cls.zgw_group1 = ZGWApiGroupConfigFactory.create( zrc_service__api_root="https://zaken-1.nl/api/v1/", drc_service__api_root="https://documenten-1.nl/api/v1/", - ztc_service__api_root="https://catalogus-1.nl/api/v1/", - zaaktype="https://catalogi-1.nl/api/v1/zaaktypen/1", - informatieobjecttype="https://catalogi-1.nl/api/v1/informatieobjecttypen/1", + ztc_service__api_root="https://catalogi-1.nl/api/v1/", organisatie_rsin="000000000", zaak_vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar, ) cls.zgw_group2 = ZGWApiGroupConfigFactory.create( zrc_service__api_root="https://zaken-2.nl/api/v1/", drc_service__api_root="https://documenten-2.nl/api/v1/", - ztc_service__api_root="https://catalogus-2.nl/api/v1/", - zaaktype="https://catalogi-2.nl/api/v1/zaaktypen/1", - informatieobjecttype="https://catalogi-2.nl/api/v1/informatieobjecttypen/1", + ztc_service__api_root="https://catalogi-2.nl/api/v1/", organisatie_rsin="000000001", zaak_vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.beperkt_openbaar, ) @@ -108,7 +104,7 @@ def install_mocks(self, m): ) m.get( - "https://catalogus-1.nl/api/v1/roltypen?zaaktype=https%3A%2F%2Fcatalogi-1.nl%2Fapi%2Fv1%2Fzaaktypen%2F1&omschrijvingGeneriek=initiator", + "https://catalogi-1.nl/api/v1/roltypen?zaaktype=https%3A%2F%2Fcatalogi-1.nl%2Fapi%2Fv1%2Fzaaktypen%2F1&omschrijvingGeneriek=initiator", status_code=200, json={ "count": 1, @@ -118,7 +114,7 @@ def install_mocks(self, m): generate_oas_component( "catalogi", "schemas/RolType", - url="https://catalogus-1.nl/api/v1/roltypen/1", + url="https://catalogi-1.nl/api/v1/roltypen/1", ) ], }, @@ -131,7 +127,7 @@ def install_mocks(self, m): ), ) m.get( - "https://catalogus-1.nl/api/v1/statustypen?zaaktype=https%3A%2F%2Fcatalogi-1.nl%2Fapi%2Fv1%2Fzaaktypen%2F1", + "https://catalogi-1.nl/api/v1/statustypen?zaaktype=https%3A%2F%2Fcatalogi-1.nl%2Fapi%2Fv1%2Fzaaktypen%2F1", status_code=200, json={ "count": 2, @@ -141,19 +137,19 @@ def install_mocks(self, m): generate_oas_component( "catalogi", "schemas/StatusType", - url="https://catalogus-1.nl/api/v1/statustypen/2", + url="https://catalogi-1.nl/api/v1/statustypen/2", volgnummer=2, ), generate_oas_component( "catalogi", "schemas/StatusType", - url="https://catalogus-1.nl/api/v1/statustypen/1", + url="https://catalogi-1.nl/api/v1/statustypen/1", volgnummer=1, ), ], }, ) - m.get("https://catalogus-1.nl/api/v1/zaaktypen", status_code=200, json=[]) + m.get("https://catalogi-1.nl/api/v1/zaaktypen", status_code=200, json=[]) m.post( "https://zaken-1.nl/api/v1/statussen", status_code=201, @@ -225,7 +221,7 @@ def install_mocks(self, m): ) m.get( - "https://catalogus-2.nl/api/v1/roltypen?zaaktype=https%3A%2F%2Fcatalogi-2.nl%2Fapi%2Fv1%2Fzaaktypen%2F1&omschrijvingGeneriek=initiator", + "https://catalogi-2.nl/api/v1/roltypen?zaaktype=https%3A%2F%2Fcatalogi-2.nl%2Fapi%2Fv1%2Fzaaktypen%2F1&omschrijvingGeneriek=initiator", status_code=200, json={ "count": 1, @@ -235,13 +231,13 @@ def install_mocks(self, m): generate_oas_component( "catalogi", "schemas/RolType", - url="https://catalogus-2.nl/api/v1/roltypen/1", + url="https://catalogi-2.nl/api/v1/roltypen/1", ) ], }, ) m.get( - "https://catalogus-2.nl/api/v1/roltypen?zaaktype=https%3A%2F%2Fcatalogi-2.nl%2Fapi%2Fv1%2Fzaaktypen%2F2&omschrijvingGeneriek=initiator", + "https://catalogi-2.nl/api/v1/roltypen?zaaktype=https%3A%2F%2Fcatalogi-2.nl%2Fapi%2Fv1%2Fzaaktypen%2F2&omschrijvingGeneriek=initiator", status_code=200, json={ "count": 1, @@ -251,12 +247,12 @@ def install_mocks(self, m): generate_oas_component( "catalogi", "schemas/RolType", - url="https://catalogus-2.nl/api/v1/roltypen/2", + url="https://catalogi-2.nl/api/v1/roltypen/2", ) ], }, ) - m.get("https://catalogus-2.nl/api/v1/zaaktypen", status_code=200, json=[]) + m.get("https://catalogi-2.nl/api/v1/zaaktypen", status_code=200, json=[]) m.post( "https://zaken-2.nl/api/v1/rollen", status_code=201, @@ -265,7 +261,7 @@ def install_mocks(self, m): ), ) m.get( - "https://catalogus-2.nl/api/v1/statustypen?zaaktype=https%3A%2F%2Fcatalogi-2.nl%2Fapi%2Fv1%2Fzaaktypen%2F1", + "https://catalogi-2.nl/api/v1/statustypen?zaaktype=https%3A%2F%2Fcatalogi-2.nl%2Fapi%2Fv1%2Fzaaktypen%2F1", status_code=200, json={ "count": 2, @@ -275,13 +271,13 @@ def install_mocks(self, m): generate_oas_component( "catalogi", "schemas/StatusType", - url="https://catalogus-2.nl/api/v1/statustypen/2", + url="https://catalogi-2.nl/api/v1/statustypen/2", volgnummer=2, ), generate_oas_component( "catalogi", "schemas/StatusType", - url="https://catalogus-2.nl/api/v1/statustypen/1", + url="https://catalogi-2.nl/api/v1/statustypen/1", volgnummer=1, ), ], @@ -309,7 +305,11 @@ def test_the_right_api_is_used(self, m): form_key="field1", _component_configuration_path="components.0", ) - zgw_form_options = {"zgw_api_group": self.zgw_group2} + zgw_form_options = { + "zgw_api_group": self.zgw_group2, + "zaaktype": "https://catalogi-2.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi-2.nl/api/v1/informatieobjecttypen/1", + } self.install_mocks(m) plugin = ZGWRegistration("zgw") @@ -340,8 +340,8 @@ def test_per_form_overwrites(self, m): ) zgw_form_options = dict( zgw_api_group=self.zgw_group2, # Configure to use the second ZGW API - zaaktype="https://catalogi-2.nl/api/v1/zaaktypen/2", # Use zaaktype 2 instead of 1 - informatieobjecttype="https://catalogi-2.nl/api/v1/informatieobjecttypen/2", # Use iot 2 instead of 1 + zaaktype="https://catalogi-2.nl/api/v1/zaaktypen/2", + informatieobjecttype="https://catalogi-2.nl/api/v1/informatieobjecttypen/2", organisatie_rsin="000000123", zaak_vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.confidentieel, doc_vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.geheim, @@ -496,11 +496,11 @@ def test_check_config(self, m): self.assertEqual(list_zaken_1.hostname, "zaken-1.nl") self.assertEqual(list_documenten_1.hostname, "documenten-1.nl") - self.assertEqual(list_zaaktypen_1.hostname, "catalogus-1.nl") + self.assertEqual(list_zaaktypen_1.hostname, "catalogi-1.nl") self.assertEqual(list_zaken_2.hostname, "zaken-2.nl") self.assertEqual(list_documenten_2.hostname, "documenten-2.nl") - self.assertEqual(list_zaaktypen_2.hostname, "catalogus-2.nl") + self.assertEqual(list_zaaktypen_2.hostname, "catalogi-2.nl") def test_check_config_no_zrc_service(self, m): self.install_mocks(m) diff --git a/src/openforms/registrations/tests/test_pre_registration.py b/src/openforms/registrations/tests/test_pre_registration.py index 498c9575e4..3e7e425e03 100644 --- a/src/openforms/registrations/tests/test_pre_registration.py +++ b/src/openforms/registrations/tests/test_pre_registration.py @@ -54,7 +54,11 @@ def test_if_preregistration_complete_retry_doesnt_repeat_it(self): zgw_group = ZGWApiGroupConfigFactory.create() submission = SubmissionFactory.create( form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, completed_not_preregistered=True, ) @@ -102,7 +106,11 @@ def test_pre_registration_task_errors_but_does_not_raise_error(self): zgw_group = ZGWApiGroupConfigFactory.create() submission = SubmissionFactory.create( form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, completed_not_preregistered=True, ) @@ -193,7 +201,11 @@ def test_retry_doesnt_overwrite_internal_reference(self): zgw_group = ZGWApiGroupConfigFactory.create() submission = SubmissionFactory.create( form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, completed_not_preregistered=True, ) @@ -224,7 +236,11 @@ def test_retry_keeps_track_of_internal_reference(self): zgw_group = ZGWApiGroupConfigFactory.create() submission = SubmissionFactory.create( form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, completed_not_preregistered=True, ) @@ -258,7 +274,11 @@ def test_retry_after_too_many_attempts_skips(self, m_get_solo): zgw_group = ZGWApiGroupConfigFactory.create() submission = SubmissionFactory.create( form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, completed_not_preregistered=True, registration_attempts=3, ) @@ -286,7 +306,11 @@ def test_update_registration_result_after_pre_registration(self): zgw_group = ZGWApiGroupConfigFactory.create() submission = SubmissionFactory.create( form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, completed_not_preregistered=True, ) @@ -309,7 +333,11 @@ def test_traceback_removed_from_result_after_success(self, m_get_solo): zgw_group = ZGWApiGroupConfigFactory.create() submission = SubmissionFactory.create( form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, completed_not_preregistered=True, registration_attempts=1, registration_result={"traceback": "An error, how sad."}, diff --git a/src/openforms/submissions/tests/test_on_completion_retry_chain.py b/src/openforms/submissions/tests/test_on_completion_retry_chain.py index 016473345e..8c3ca3195f 100644 --- a/src/openforms/submissions/tests/test_on_completion_retry_chain.py +++ b/src/openforms/submissions/tests/test_on_completion_retry_chain.py @@ -40,7 +40,11 @@ def test_payment_status_update_now_succeeds(self): needs_on_completion_retry=True, registration_success=True, form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, form__payment_backend="ogone-legacy", registration_result={ "zaak": { @@ -90,7 +94,11 @@ def test_payment_status_update_still_fails(self): needs_on_completion_retry=True, registration_success=True, form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, form__payment_backend="ogone-legacy", registration_result={ "zaak": { @@ -151,7 +159,11 @@ def test_backend_registration_still_fails(self, mock_update_payment): needs_on_completion_retry=True, registration_failed=True, form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, # registration failed, so an internal reference was created public_registration_reference="OF-1234", ) @@ -184,7 +196,11 @@ def test_backend_preregistration_still_fails(self, mock_update_payment): pre_registration_completed=False, registration_failed=True, form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, # registration failed, so an internal reference was created public_registration_reference="OF-1234", ) @@ -223,7 +239,11 @@ def test_backend_registration_succeeds(self, mock_update_payment): needs_on_completion_retry=True, registration_failed=True, form__registration_backend="zgw-create-zaak", - form__registration_backend_options={"zgw_api_group": zgw_group.pk}, + form__registration_backend_options={ + "zgw_api_group": zgw_group.pk, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, # registration failed, so an internal reference was created public_registration_reference="OF-1234", with_completed_payment=True, @@ -251,7 +271,12 @@ def test_backend_registration_succeeds(self, mock_update_payment): mock_register.assert_called_once() # downstream tasks should not have been called - chain should abort mock_update_payment.assert_called_once_with( - submission, {"zgw_api_group": zgw_group} + submission, + { + "zgw_api_group": zgw_group, + "zaaktype": "https://catalogi.nl/api/v1/zaaktypen/1", + "informatieobjecttype": "https://catalogi.nl/api/v1/informatieobjecttypen/1", + }, ) self.assertNotEqual(submission.last_register_date, original_register_date) self.assertEqual(submission.public_registration_reference, "OF-1234")