From cb2f460d332ba78b67328be910a1cabc72ea5c7c Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Wed, 3 Apr 2024 15:32:12 +0200 Subject: [PATCH] :coffin: [#4073] Remove unused StUF-ZDS 'gemeentecode' This has never been used anywhere, not even in Open Forms 1.0 --- src/openforms/config/tests/test_config_check.py | 2 +- .../management/commands/stuf_zds_test_stp.py | 1 - .../registrations/contrib/stuf_zds/plugin.py | 10 ---------- .../contrib/stuf_zds/tests/test_config_check.py | 12 +----------- src/stuf/stuf_zds/client.py | 1 - .../0002_remove_stufzdsconfig_gemeentecode.py | 17 +++++++++++++++++ src/stuf/stuf_zds/models.py | 12 ------------ src/stuf/stuf_zds/tests/test_backend.py | 1 - src/stuf/stuf_zds/tests/test_client.py | 1 - 9 files changed, 19 insertions(+), 38 deletions(-) create mode 100644 src/stuf/stuf_zds/migrations/0002_remove_stufzdsconfig_gemeentecode.py diff --git a/src/openforms/config/tests/test_config_check.py b/src/openforms/config/tests/test_config_check.py index 3c691e7f76..bb5ad73808 100644 --- a/src/openforms/config/tests/test_config_check.py +++ b/src/openforms/config/tests/test_config_check.py @@ -78,7 +78,7 @@ def test_disabled_plugins_are_skipped(self, mock_get_solo): "stuf.stuf_zds.client.parse_soap_error_text", return_value="(parsed error text)" ) def test_check_config_service_failure_correctly_reported(self, m, *mocks): - config = StufZDSConfig(service=StufServiceFactory.create(), gemeentecode="1234") + config = StufZDSConfig(service=StufServiceFactory.create()) m.get( "http://zaken/soap/?wsdl", status_code=500, diff --git a/src/openforms/registrations/contrib/stuf_zds/management/commands/stuf_zds_test_stp.py b/src/openforms/registrations/contrib/stuf_zds/management/commands/stuf_zds_test_stp.py index 8c4e5c926d..233d90027d 100644 --- a/src/openforms/registrations/contrib/stuf_zds/management/commands/stuf_zds_test_stp.py +++ b/src/openforms/registrations/contrib/stuf_zds/management/commands/stuf_zds_test_stp.py @@ -37,7 +37,6 @@ def handle(self, *args, **options): ) client_options: ZaakOptions = { - "gemeentecode": "1234", "omschrijving": "my-form", "zds_zaaktype_code": "zt-code", "zds_zaaktype_omschrijving": "zt-omschrijving", diff --git a/src/openforms/registrations/contrib/stuf_zds/plugin.py b/src/openforms/registrations/contrib/stuf_zds/plugin.py index a6faf1fc52..f03b4afe82 100644 --- a/src/openforms/registrations/contrib/stuf_zds/plugin.py +++ b/src/openforms/registrations/contrib/stuf_zds/plugin.py @@ -36,11 +36,6 @@ class ZaakOptionsSerializer(JsonSchemaSerializerMixin, serializers.Serializer): - gemeentecode = serializers.CharField( - required=False, - help_text=_("Municipality code to register zaken"), - ) - zds_zaaktype_code = serializers.CharField( required=True, help_text=_("Zaaktype code for newly created Zaken in StUF-ZDS"), @@ -329,11 +324,6 @@ def check_config(self): config = StufZDSConfig.get_solo() assert isinstance(config, StufZDSConfig) - if not config.gemeentecode: - raise InvalidPluginConfiguration( - _("StufService missing setting '{name}'").format(name="gemeentecode") - ) - options: ZaakOptions = { "omschrijving": "MyForm", "zds_zaaktype_code": "test", diff --git a/src/openforms/registrations/contrib/stuf_zds/tests/test_config_check.py b/src/openforms/registrations/contrib/stuf_zds/tests/test_config_check.py index 777f170437..cab984557d 100644 --- a/src/openforms/registrations/contrib/stuf_zds/tests/test_config_check.py +++ b/src/openforms/registrations/contrib/stuf_zds/tests/test_config_check.py @@ -16,10 +16,7 @@ class ConfigCheckTests(SimpleTestCase): def setUp(self): super().setUp() - self.config = StufZDSConfig( - service=StufServiceFactory.build(), - gemeentecode="foo", - ) + self.config = StufZDSConfig(service=StufServiceFactory.build()) patcher = patch( "stuf.stuf_zds.client.StufZDSConfig.get_solo", return_value=self.config, @@ -34,13 +31,6 @@ def test_no_service_configured(self): with self.assertRaises(InvalidPluginConfiguration): plugin.check_config() - def test_missing_gemeentecode(self): - self.config.gemeentecode = "" - plugin = StufZDSRegistration(PLUGIN_IDENTIFIER) - - with self.assertRaises(InvalidPluginConfiguration): - plugin.check_config() - @requests_mock.Mocker() def test_failing_request(self, m): m.post(requests_mock.ANY, exc=requests.ConnectionError("nope")) diff --git a/src/stuf/stuf_zds/client.py b/src/stuf/stuf_zds/client.py index 31d9f1d2a0..f40e32ed1c 100644 --- a/src/stuf/stuf_zds/client.py +++ b/src/stuf/stuf_zds/client.py @@ -76,7 +76,6 @@ def xml_value(xml, xpath, namespaces=nsmap): class ZaakOptions(TypedDict): # from stuf_zds.plugin.ZaakOptionsSerializer - gemeentecode: str # unused?? can't find any template using this zds_zaaktype_code: str zds_zaaktype_omschrijving: str zds_zaaktype_status_code: str diff --git a/src/stuf/stuf_zds/migrations/0002_remove_stufzdsconfig_gemeentecode.py b/src/stuf/stuf_zds/migrations/0002_remove_stufzdsconfig_gemeentecode.py new file mode 100644 index 0000000000..363bafba04 --- /dev/null +++ b/src/stuf/stuf_zds/migrations/0002_remove_stufzdsconfig_gemeentecode.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.11 on 2024-04-03 13:31 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("stuf_zds", "0001_initial_to_openforms_v230"), + ] + + operations = [ + migrations.RemoveField( + model_name="stufzdsconfig", + name="gemeentecode", + ), + ] diff --git a/src/stuf/stuf_zds/models.py b/src/stuf/stuf_zds/models.py index eb9f6c0825..49e91e57b9 100644 --- a/src/stuf/stuf_zds/models.py +++ b/src/stuf/stuf_zds/models.py @@ -3,8 +3,6 @@ from solo.models import SingletonModel -from openforms.utils.validators import validate_digits - class StufZDSConfigManager(models.Manager): def get_queryset(self) -> models.QuerySet: @@ -24,17 +22,7 @@ class StufZDSConfig(SingletonModel): null=True, ) - gemeentecode = models.CharField( - _("Municipality code"), - max_length=4, - help_text=_("Municipality code to register zaken"), - validators=[validate_digits], - ) - objects = StufZDSConfigManager() - def apply_defaults_to(self, options): - options.setdefault("gemeentecode", self.gemeentecode) - class Meta: verbose_name = _("StUF-ZDS configuration") diff --git a/src/stuf/stuf_zds/tests/test_backend.py b/src/stuf/stuf_zds/tests/test_backend.py index baa5597ead..9cac4202f5 100644 --- a/src/stuf/stuf_zds/tests/test_backend.py +++ b/src/stuf/stuf_zds/tests/test_backend.py @@ -44,7 +44,6 @@ def setUpTestData(cls): ) cls.options: ZaakOptions = { - "gemeentecode": "1234", "omschrijving": "my-form", "zds_zaaktype_code": "zt-code", "zds_zaaktype_omschrijving": "zt-omschrijving", diff --git a/src/stuf/stuf_zds/tests/test_client.py b/src/stuf/stuf_zds/tests/test_client.py index 0daafe0768..3bce29aec5 100644 --- a/src/stuf/stuf_zds/tests/test_client.py +++ b/src/stuf/stuf_zds/tests/test_client.py @@ -39,7 +39,6 @@ def setUpTestData(cls): ) cls.client_options: ZaakOptions = { - "gemeentecode": "1234", "omschrijving": "my-form", "zds_zaaktype_code": "zt-code", "zds_zaaktype_omschrijving": "zt-omschrijving",