Exemple #1
0
    def test_phone_number_parsing(self):
        alice = User.objects.create_user('alice', '*****@*****.**', 'passwd')
        alice.save()

        profile = UserProfile(user=alice,
                              biography='Just a small-town girl...',
                              playa_name='Yoshi')
        profile.save()

        test_cases = [
            '5555555555',
            '555-555-5555',
            '15555555555',
            '1-555-555-5555',
            '+15555555555',
            '+1-555-555-5555',
        ]

        for phone_number in test_cases:
            parsed_number = UserProfile.parse_phone_number(phone_number)
            assert len(parsed_number) == 12

        self.assertTrue(True)
    def test_phone_number_parsing(self):
        alice = User.objects.create_user('alice', '*****@*****.**', 'passwd')
        alice.save()

        profile = UserProfile(user=alice,
                              biography='Just a small-town girl...',
                              playa_name='Yoshi')
        profile.save()

        test_cases = [
            '5555555555',
            '555-555-5555',
            '15555555555',
            '1-555-555-5555',
            '+15555555555',
            '+1-555-555-5555',
        ]

        for phone_number in test_cases:
            parsed_number = UserProfile.parse_phone_number(phone_number)
            assert len(parsed_number) == 12

        self.assertTrue(True)
Exemple #3
0
 def clean_phone(self) -> str:
     return UserProfile.parse_phone_number(self.cleaned_data['phone'])
Exemple #4
0
 def clean_phone(self) -> str:
     return UserProfile.parse_phone_number(self.cleaned_data['phone'])