Let users register with int’national phone numbers

Right now Notify restricts you to registering with a UK mobile number.
This is because when we built the user registration stuff we couldn’t
send to international mobiles.

However we can send to international mobile numbers, and it’s totally
reasonable to expect employees of the UK government to be working
abroad, and have a foreign mobile phone – we’ve heard from one such
user.

So this commit:
- changes all places where users enter their own phone number to use
  the validation function which allows international phone numbers
- renames the `mobile_number` validation to `uk_mobile_number` to make
  it explicit, and force it to break the tests if there’s somewhere it’s
  being used that I haven’t thought of
This commit is contained in:
Chris Hill-Scott
2017-08-29 14:52:24 +01:00
parent a75567ba50
commit 188ce5e5a7
5 changed files with 41 additions and 15 deletions

View File

@@ -1,3 +1,5 @@
import pytest
from datetime import datetime
from bs4 import BeautifulSoup
from unittest.mock import ANY
@@ -30,6 +32,10 @@ def test_logged_in_user_redirects_to_choose_service(
assert response.location == url_for('main.choose_service', _external=True)
@pytest.mark.parametrize('phone_number_to_register_with', [
'+4407700900460',
'+1800-555-555',
])
def test_register_creates_new_user_and_redirects_to_continue_page(
client,
mock_send_verify_code,
@@ -38,10 +44,11 @@ def test_register_creates_new_user_and_redirects_to_continue_page(
mock_is_email_unique,
mock_send_verify_email,
mock_login,
phone_number_to_register_with,
):
user_data = {'name': 'Some One Valid',
'email_address': 'notfound@example.gov.uk',
'mobile_number': '+4407700900460',
'mobile_number': phone_number_to_register_with,
'password': 'validPassword!'
}