Skip to content

Commit

Permalink
[#233] Update some names
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Jan 6, 2025
1 parent 984597a commit 2ea6385
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/openklant/components/klantinteracties/models/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PartijIdentificatorValidator:
PartijIdentificatorCodeSoortObjectId.kvk_nummer.value,
]

REGISTERS = {
ALLOWED_OBJECT_TYPES_FOR_REGISTRIES = {
PartijIdentificatorCodeRegister.brp: {
PartijIdentificatorCodeObjectType.natuurlijk_persoon: NATUURLIJK_PERSOON,
},
Expand Down Expand Up @@ -68,7 +68,10 @@ def validate_code_objecttype(self) -> None:
):
return

if self.code_objecttype not in self.REGISTERS[self.code_register]:
if (
self.code_objecttype
not in self.ALLOWED_OBJECT_TYPES_FOR_REGISTRIES[self.code_register]
):
raise ValidationError(
{
"partij_identificator_code_objecttype": _(
Expand All @@ -89,7 +92,9 @@ def validate_code_soort_object_id(self) -> None:
return

if self.code_soort_object_id not in (
choices := self.REGISTERS[self.code_register].get(self.code_objecttype, [])
choices := self.ALLOWED_OBJECT_TYPES_FOR_REGISTRIES[self.code_register].get(
self.code_objecttype, []
)
):

raise ValidationError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_code_soort_object_id_not_found_in_code_objecttype(self):
"voor `codeObjecttype` natuurlijk_persoon zijn alleen deze waarden toegestaan: ['bsn']",
)

def test_oveirige_code_objecttype_ok_code_soort_object_id(self):
def test_overig_code_objecttype_ok_code_soort_object_id(self):
validator = PartijIdentificatorValidator(
code_objecttype=PartijIdentificatorCodeObjectType.overig.value,
code_soort_object_id=PartijIdentificatorCodeSoortObjectId.bsn.value,
Expand Down

0 comments on commit 2ea6385

Please sign in to comment.