register and sign in pages
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from users.mobile import normalize_mobile
|
||||
|
||||
|
||||
class NormalizeMobileTests(SimpleTestCase):
|
||||
def test_accepts_every_way_a_number_is_typed(self):
|
||||
for value in ["7712345", "+9607712345", "9607712345", "960 771 2345", "009607712345", "771-2345"]:
|
||||
with self.subTest(value=value):
|
||||
self.assertEqual(normalize_mobile(value), "+9607712345")
|
||||
|
||||
def test_rejects_invalid_numbers(self):
|
||||
for value in ["", "123", "1712345", "77123456", "abcdefg", None]:
|
||||
with self.subTest(value=value):
|
||||
with self.assertRaises(ValidationError):
|
||||
normalize_mobile(value)
|
||||
Reference in New Issue
Block a user