From 2ea6385a3817b2d08982ba2bd8c8ffd8360f3bed Mon Sep 17 00:00:00 2001 From: Daniel Mursa Date: Mon, 6 Jan 2025 14:38:45 +0100 Subject: [PATCH] [#233] Update some names --- .../components/klantinteracties/models/validators.py | 11 ++++++++--- .../klantinteracties/tests/test_validators.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/openklant/components/klantinteracties/models/validators.py b/src/openklant/components/klantinteracties/models/validators.py index 8dfdc091..d9a9162e 100644 --- a/src/openklant/components/klantinteracties/models/validators.py +++ b/src/openklant/components/klantinteracties/models/validators.py @@ -23,7 +23,7 @@ class PartijIdentificatorValidator: PartijIdentificatorCodeSoortObjectId.kvk_nummer.value, ] - REGISTERS = { + ALLOWED_OBJECT_TYPES_FOR_REGISTRIES = { PartijIdentificatorCodeRegister.brp: { PartijIdentificatorCodeObjectType.natuurlijk_persoon: NATUURLIJK_PERSOON, }, @@ -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": _( @@ -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( diff --git a/src/openklant/components/klantinteracties/tests/test_validators.py b/src/openklant/components/klantinteracties/tests/test_validators.py index 6fd02bfa..b87c81d6 100644 --- a/src/openklant/components/klantinteracties/tests/test_validators.py +++ b/src/openklant/components/klantinteracties/tests/test_validators.py @@ -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,