Exemplo n.º 1
0
    def test_bad_input(self):
        inputs = [
            'this is not a phone number', '1.2.3.4.5', '+316-123-456c', ''
        ]

        for i, inp in enumerate(inputs):
            with self.subTest(i=i):
                with self.assertRaises(exceptions.BadRequestException):
                    output = utils.format_phone_number(inp)
Exemplo n.º 2
0
 def test_dashes(self):
     input = '+31-6-123-45678'
     expected = '+31612345678'
     output = utils.format_phone_number(input)
     self.assertEqual(output, expected)
Exemplo n.º 3
0
 def test_foreign(self):
     input = '+42612345678'
     expected = '+42612345678'
     output = utils.format_phone_number(input)
     self.assertEqual(output, expected)
Exemplo n.º 4
0
 def test_0_to_plus31(self):
     input = '0612345678'
     expected = '+31612345678'
     output = utils.format_phone_number(input)
     self.assertEqual(output, expected)
Exemplo n.º 5
0
 def test_already_formatted(self):
     input = '+31612345678'
     expected = '+31612345678'
     output = utils.format_phone_number(input)
     self.assertEqual(output, expected)