Skip to content

Commit

Permalink
[#233] Update3
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Dec 20, 2024
1 parent 65930dd commit e7449fb
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/openklant/components/klantinteracties/tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,46 @@ def test_valid_empty_code_soort_object_id(self):
validator = PartijIdentificatorValidator(**data)
validator.validate_code_soort_object_id()

def test_empty_code_objecttype_ok_code_soort_object_id(self):
data = {
"code_objecttype": "",
"code_soort_object_id": "bsn",
"object_id": "12345678",
"code_register": "brp",
}
validator = PartijIdentificatorValidator(**data)
validator.validate_code_soort_object_id()

def test_oveirige_code_objecttype_ok_code_soort_object_id(self):
data = {
"code_objecttype": "overige",
"code_soort_object_id": "bsn",
"object_id": "12345678",
"code_register": "brp",
}
validator = PartijIdentificatorValidator(**data)
validator.validate_code_soort_object_id()

def test_code_soort_object_id_not_found_in_code_objecttype(self):
data = {
"code_objecttype": "natuurlijk_persoon",
"code_soort_object_id": "rsin",
"object_id": "12345678",
"code_register": "brp",
}
with self.assertRaises(serializers.ValidationError) as error:
validator = PartijIdentificatorValidator(**data)
validator.validate()

details = error.exception.get_full_details()
self.assertEqual(
details["partijIdentificator.codeSoortObjectId"]["message"],
"codeSoortObjectId keuzes zijn beperkt op basis van codeObjecttype.",
)
self.assertEqual(
details["partijIdentificator.codeSoortObjectId"]["code"], "invalid"
)

# Start validate_object_id section

def test_valid_empty_object_id(self):
Expand Down

0 comments on commit e7449fb

Please sign in to comment.