Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused StUF-ZDS 'gemeentecode' #4111

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 0 additions & 2 deletions 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 Expand Up @@ -104,7 +103,6 @@ class NoServiceConfigured(RuntimeError):
def get_client(options: ZaakOptions) -> "Client":
config = StufZDSConfig.get_solo()
assert isinstance(config, StufZDSConfig)
config.apply_defaults_to(options)
if not (service := config.service):
raise NoServiceConfigured("You must configure a service!")
return StufZDSClient(service, options)
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
Loading