mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Let whitelist and user have int. phone numbers
On the frontend, we’re letting users register with international phone numbers. So we shouldn’t block users from doing this on the API side. Same thing for the whitelist, where we’re also allowing international phone numbers now.
This commit is contained in:
@@ -23,19 +23,24 @@ from app.models import User, VerifyCode
|
||||
from tests.app.db import create_user
|
||||
|
||||
|
||||
def test_create_user(notify_db_session):
|
||||
@pytest.mark.parametrize('phone_number', [
|
||||
'+447700900986',
|
||||
'+1-800-555-5555',
|
||||
])
|
||||
def test_create_user(notify_db_session, phone_number):
|
||||
email = 'notify@digital.cabinet-office.gov.uk'
|
||||
data = {
|
||||
'name': 'Test User',
|
||||
'email_address': email,
|
||||
'password': 'password',
|
||||
'mobile_number': '+447700900986'
|
||||
'mobile_number': phone_number
|
||||
}
|
||||
user = User(**data)
|
||||
save_model_user(user)
|
||||
assert User.query.count() == 1
|
||||
assert User.query.first().email_address == email
|
||||
assert User.query.first().id == user.id
|
||||
assert User.query.first().mobile_number == phone_number
|
||||
assert not user.platform_admin
|
||||
|
||||
|
||||
|
||||
@@ -24,14 +24,15 @@ def test_get_whitelist_returns_data(client, sample_service_whitelist):
|
||||
def test_get_whitelist_separates_emails_and_phones(client, sample_service):
|
||||
dao_add_and_commit_whitelisted_contacts([
|
||||
ServiceWhitelist.from_string(sample_service.id, EMAIL_TYPE, 'service@example.com'),
|
||||
ServiceWhitelist.from_string(sample_service.id, MOBILE_TYPE, '07123456789')
|
||||
ServiceWhitelist.from_string(sample_service.id, MOBILE_TYPE, '07123456789'),
|
||||
ServiceWhitelist.from_string(sample_service.id, MOBILE_TYPE, '+1800-555-555'),
|
||||
])
|
||||
|
||||
response = client.get('service/{}/whitelist'.format(sample_service.id), headers=[create_authorization_header()])
|
||||
assert response.status_code == 200
|
||||
assert json.loads(response.get_data(as_text=True)) == {
|
||||
'email_addresses': ['service@example.com'],
|
||||
'phone_numbers': ['07123456789']
|
||||
'phone_numbers': ['+1800-555-555', '07123456789']
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user