Skip to content

Commit

Permalink
[#310] Create tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Jan 8, 2025
1 parent cd71054 commit b4accc9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/openklant/utils/tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
validate_no_space,
validate_phone_number,
validate_postal_code,
validate_bag_id,
)


Expand Down Expand Up @@ -147,3 +148,28 @@ def test_validate_iban(self):
self.assertIsNone(validate_iban("ab1299999999999"))
self.assertIsNone(validate_iban("ab129"))
self.assertIsNone(validate_iban("ab12aaaaaaaaaa"))

def test_validate_bag_id(self):
"""
Test Basisregistratie Adressen en Gebouwen ID
"""
invalid_ids = [
"",
"1",
"1000 AAA",
"1000AAA",
"000000000000000",
"AAAAAAAAAAAAAAAA",
"1234-1234-1234-1234",
"123A123A123A123A",
]
for bag_id in invalid_ids:
self.assertRaisesMessage(
ValidationError,
"Ongeldige nummeraanduiding BAG-ID",
validate_bag_id,
bag_id,
)

self.assertIsNone(validate_bag_id("1234567890000001"))
self.assertIsNone(validate_bag_id("1111111111111111"))

0 comments on commit b4accc9

Please sign in to comment.