Skip to content

Commit

Permalink
Merge pull request #182 from open-zaak/issue/bio-validator-incorrect-…
Browse files Browse the repository at this point in the history
…code

change code and rename BesluittypeInformatieobjecttypeRelationValidator
  • Loading branch information
sergei-maertens committed Nov 7, 2019
2 parents e603137 + 066ee8e commit c1c5d65
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/openzaak/components/besluiten/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
from ..constants import VervalRedenen
from ..models import Besluit, BesluitInformatieObject
from .validators import (
BesluittypeInformatieobjecttypeRelationValidator,
BesluittypeZaaktypeValidator,
UniekeIdentificatieValidator,
ZaaktypeInformatieobjecttypeRelationValidator,
)


Expand Down Expand Up @@ -91,7 +91,7 @@ class Meta:
queryset=BesluitInformatieObject.objects.all(),
fields=["besluit", "informatieobject"],
),
ZaaktypeInformatieobjecttypeRelationValidator(),
BesluittypeInformatieobjecttypeRelationValidator(),
]
extra_kwargs = {
"url": {"lookup_field": "uuid"},
Expand Down
8 changes: 5 additions & 3 deletions src/openzaak/components/besluiten/api/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ def __call__(self, attrs):
raise serializers.ValidationError(self.message, code=self.code)


class ZaaktypeInformatieobjecttypeRelationValidator:
code = "missing-zaaktype-informatieobjecttype-relation"
message = _("Het informatieobjecttype hoort niet bij het zaaktype van de zaak.")
class BesluittypeInformatieobjecttypeRelationValidator:
code = "missing-besluittype-informatieobjecttype-relation"
message = _(
"Het informatieobjecttype hoort niet bij het besluitype van de besluit."
)

def __call__(self, attrs):
informatieobject = attrs.get("informatieobject")
Expand Down
4 changes: 2 additions & 2 deletions src/openzaak/components/besluiten/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def test_validate_informatieobject_invalid(self):
error = get_validation_errors(response, "informatieobject")
self.assertEqual(error["code"], "bad-url")

def test_validate_no_informatieobjecttype_zaaktype_relation(self):
def test_validate_no_informatieobjecttype_besluittype_relation(self):
zaak = ZaakFactory.create()
besluit = BesluitFactory.create(zaak=zaak)
besluit_url = reverse(besluit)
Expand All @@ -283,5 +283,5 @@ def test_validate_no_informatieobjecttype_zaaktype_relation(self):

error = get_validation_errors(response, "nonFieldErrors")
self.assertEqual(
error["code"], "missing-zaaktype-informatieobjecttype-relation"
error["code"], "missing-besluittype-informatieobjecttype-relation"
)

0 comments on commit c1c5d65

Please sign in to comment.