Skip to content

Commit

Permalink
⚰️ [#4073] Remove unused StUF-ZDS 'gemeentecode'
Browse files Browse the repository at this point in the history
This has never been used anywhere, not even in Open Forms 1.0
  • Loading branch information
sergei-maertens committed Apr 3, 2024
1 parent 919feed commit cb2f460
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/openforms/config/tests/test_config_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 0 additions & 10 deletions src/openforms/registrations/contrib/stuf_zds/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"))
Expand Down
1 change: 0 additions & 1 deletion src/stuf/stuf_zds/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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",
),
]
12 changes: 0 additions & 12 deletions src/stuf/stuf_zds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")
1 change: 0 additions & 1 deletion src/stuf/stuf_zds/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/stuf/stuf_zds/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit cb2f460

Please sign in to comment.