Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 [#235] improve the way we validate phonenumbers #284

Merged
merged 3 commits into from
Nov 22, 2024

Conversation

bart-maykin
Copy link
Contributor

Fixes #235

Changes

Improved the way we validate phonenumbers with the phonenumbers library

@bart-maykin bart-maykin force-pushed the feature/235-better-phonenumber-validator branch from 5fb8a86 to b4fa414 Compare November 21, 2024 08:53
@bart-maykin bart-maykin requested a review from SonnyBA November 21, 2024 08:53
@@ -74,25 +74,37 @@ def test_validate_postal_code(self):
self.assertIsNone(validate_postal_code("1015 cJ"))

def test_validate_phone_number(self):
valid_phone_numbers = [
"+31612345678",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would/should something like 0612345678 still be valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and I added it to the test to proof it.

Copy link
Collaborator

@stevenbal stevenbal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this also requires validation on DigitaalAdres.adres if soort_digitaal_adres is telefoonnummer (similar approach as done for emails #271)

@bart-maykin
Copy link
Contributor Author

@stevenbal I replaced the OptionalEmailValidator with SoortDigitaalAdresValidator, because the original validator was specificly made anyway. I kept the same construction as the original implementation.

@bart-maykin bart-maykin requested a review from SonnyBA November 21, 2024 15:52
@bart-maykin bart-maykin force-pushed the feature/235-better-phonenumber-validator branch from ab31581 to 34b1ea4 Compare November 21, 2024 17:48
Copy link
Contributor

@SonnyBA SonnyBA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there! Whenever those subtests are split up this can be merged if you ask me.

@@ -123,10 +123,10 @@ def test_digitaal_adres_inline(self):
@disable_admin_mfa()
class DigitaalAdresAdminTests(WebTest):
@tag("gh-234")
def test_email_validation(self):
def test_soort_digitaal_adres_validation(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bart-maykin could you split the three subtests into their own tests?

@bart-maykin bart-maykin requested a review from SonnyBA November 22, 2024 11:13
Copy link
Contributor

@SonnyBA SonnyBA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time to press the green button 👍

@SonnyBA SonnyBA merged commit be19464 into master Nov 22, 2024
17 checks passed
@SonnyBA SonnyBA deleted the feature/235-better-phonenumber-validator branch November 22, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation of any stored phone number
3 participants