Skip to content

Commit

Permalink
Merge pull request #1389 from open-zaak/issue/eigenschap-specificatie…
Browse files Browse the repository at this point in the history
…-group

allow space in eigenschap.specificatie.group
  • Loading branch information
annashamray committed Jun 26, 2023
2 parents ae8690c + d5fd0a4 commit 6d09059
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: EUPL-1.2
# Copyright (C) 2023 Dimpact
# Generated by Django 3.2.18 on 2023-06-20 12:36

from django.db import migrations, models
import openzaak.components.catalogi.models.validators


class Migration(migrations.Migration):

dependencies = [
("catalogi", "0012_merge_0011_auto_20220329_0921_0011_auto_20220531_1017"),
]

operations = [
migrations.AlterField(
model_name="eigenschapspecificatie",
name="groep",
field=models.CharField(
blank=True,
help_text="Benaming van het object of groepattribuut waarvan de EIGENSCHAP een inhoudelijk gegeven specificeert.",
max_length=32,
validators=[
openzaak.components.catalogi.models.validators.validate_letters_numbers_underscores_spaces
],
verbose_name="groep",
),
),
]
4 changes: 2 additions & 2 deletions src/openzaak/components/catalogi/models/eigenschap.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..constants import FormaatChoices
from .validators import (
validate_kardinaliteit,
validate_letters_numbers_underscores,
validate_letters_numbers_underscores_spaces,
validate_zaaktype_concept,
)

Expand All @@ -30,7 +30,7 @@ class EigenschapSpecificatie(models.Model):
_("groep"),
max_length=32,
blank=True,
validators=[validate_letters_numbers_underscores],
validators=[validate_letters_numbers_underscores_spaces],
help_text=_(
"Benaming van het object of groepattribuut waarvan de EIGENSCHAP een "
"inhoudelijk gegeven specificeert."
Expand Down
27 changes: 27 additions & 0 deletions src/openzaak/components/catalogi/tests/test_eigenschap.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,33 @@ def test_create_eigenschap_fail_not_concept_zaaktype(self):
error = get_validation_errors(response, "nonFieldErrors")
self.assertEqual(error["code"], ZaakTypeConceptValidator.code)

def test_create_eigenschap_with_space_in_specificatie_group(self):
zaaktype = ZaakTypeFactory.create(catalogus=self.catalogus)
zaaktype_url = reverse("zaaktype-detail", kwargs={"uuid": zaaktype.uuid})
eigenschap_list_url = reverse("eigenschap-list")
data = {
"naam": "Beoogd product",
"definitie": "test",
"toelichting": "",
"zaaktype": "http://testserver{}".format(zaaktype_url),
"specificatie": {
"groep": "test 1",
"formaat": "tekst",
"lengte": "5",
"kardinaliteit": "1",
"waardenverzameling": [],
},
}

response = self.client.post(eigenschap_list_url, data)

self.assertEqual(response.status_code, status.HTTP_201_CREATED)

eigenschap = Eigenschap.objects.get()
specificatie = eigenschap.specificatie_van_eigenschap

self.assertEqual(specificatie.groep, "test 1")

def test_delete_eigenschap(self):
eigenschap = EigenschapFactory.create()
eigenschap_url = reverse("eigenschap-detail", kwargs={"uuid": eigenschap.uuid})
Expand Down

0 comments on commit 6d09059

Please sign in to comment.