diff --git a/app/main/forms.py b/app/main/forms.py index ed27caa81..8884fdfa7 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1241,26 +1241,26 @@ class PDFUploadForm(StripWhitespaceForm): ) -class EmailFieldInWhitelist(EmailField, StripWhitespaceStringField): +class EmailFieldInGuestList(EmailField, StripWhitespaceStringField): pass -class InternationalPhoneNumberInWhitelist(InternationalPhoneNumber, StripWhitespaceStringField): +class InternationalPhoneNumberInGuestList(InternationalPhoneNumber, StripWhitespaceStringField): pass -class Whitelist(StripWhitespaceForm): +class GuestList(StripWhitespaceForm): def populate(self, email_addresses, phone_numbers): - for form_field, existing_whitelist in ( + for form_field, existing_guest_list in ( (self.email_addresses, email_addresses), (self.phone_numbers, phone_numbers) ): - for index, value in enumerate(existing_whitelist): + for index, value in enumerate(existing_guest_list): form_field[index].data = value email_addresses = FieldList( - EmailFieldInWhitelist( + EmailFieldInGuestList( '', validators=[ Optional(), @@ -1274,7 +1274,7 @@ class Whitelist(StripWhitespaceForm): ) phone_numbers = FieldList( - InternationalPhoneNumberInWhitelist( + InternationalPhoneNumberInGuestList( '', validators=[ Optional() diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index 8ea786659..8fe5e1c88 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -18,9 +18,9 @@ from app import ( from app.main import main from app.main.forms import ( CreateKeyForm, + GuestList, ServiceDeliveryStatusCallbackForm, ServiceReceiveMessagesCallbackForm, - Whitelist, ) from app.notify_client.api_key_api_client import ( KEY_TYPE_NORMAL, @@ -52,21 +52,22 @@ def api_documentation(service_id): return redirect(url_for('.documentation'), code=301) -@main.route("/services//api/whitelist", methods=['GET', 'POST']) +@main.route("/services//api/whitelist", methods=['GET', 'POST'], endpoint='old_guest_list') +@main.route("/services//api/guest-list", methods=['GET', 'POST']) @user_has_permissions('manage_api_keys') -def whitelist(service_id): - form = Whitelist() +def guest_list(service_id): + form = GuestList() if form.validate_on_submit(): - service_api_client.update_whitelist(service_id, { + service_api_client.update_guest_list(service_id, { 'email_addresses': list(filter(None, form.email_addresses.data)), 'phone_numbers': list(filter(None, form.phone_numbers.data)) }) - flash('Whitelist updated', 'default_with_tick') + flash('Guest list updated', 'default_with_tick') return redirect(url_for('.api_integration', service_id=service_id)) if not form.errors: - form.populate(**service_api_client.get_whitelist(service_id)) + form.populate(**service_api_client.get_guest_list(service_id)) return render_template( - 'views/api/whitelist.html', + 'views/api/guest-list.html', form=form ) @@ -85,7 +86,7 @@ def create_api_key(service_id): form = CreateKeyForm(current_service.api_keys) form.key_type.choices = [ (KEY_TYPE_NORMAL, 'Live – sends to anyone'), - (KEY_TYPE_TEAM, 'Team and whitelist – limits who you can send to'), + (KEY_TYPE_TEAM, 'Team and guest list – limits who you can send to'), (KEY_TYPE_TEST, 'Test – pretends to send messages'), ] disabled_options, option_hints = [], {} diff --git a/app/navigation.py b/app/navigation.py index d98fba4cb..0368112d4 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -348,7 +348,8 @@ class HeaderNavigation(Navigation): 'view_template_version', 'no_cookie.view_template_version_preview', 'view_template_versions', - 'whitelist', + 'guest_list', + 'old_guest_list', 'who_can_use_notify', 'who_its_for', } @@ -480,7 +481,8 @@ class MainNavigation(Navigation): 'delivery_status_callback', 'received_text_messages_callback', 'revoke_api_key', - 'whitelist', + 'guest_list', + 'old_guest_list', }, } @@ -975,7 +977,8 @@ class CaseworkNavigation(Navigation): 'view_template_version', 'no_cookie.view_template_version_preview', 'view_template_versions', - 'whitelist', + 'guest_list', + 'old_guest_list', 'who_can_use_notify', 'who_its_for', } @@ -1285,7 +1288,8 @@ class OrgNavigation(Navigation): 'view_template_version', 'no_cookie.view_template_version_preview', 'view_template_versions', - 'whitelist', + 'guest_list', + 'old_guest_list', 'who_can_use_notify', 'who_its_for', } diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index 7378e2de1..1747a171f 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -326,11 +326,11 @@ class ServiceAPIClient(NotifyAdminAPIClient): def get_monthly_notification_stats(self, service_id, year): return self.get(url='/service/{}/notifications/monthly?year={}'.format(service_id, year)) - def get_whitelist(self, service_id): + def get_guest_list(self, service_id): return self.get(url='/service/{}/whitelist'.format(service_id)) @cache.delete('service-{service_id}') - def update_whitelist(self, service_id, data): + def update_guest_list(self, service_id, data): return self.put(url='/service/{}/whitelist'.format(service_id), data=data) def get_inbound_sms(self, service_id, user_number=''): diff --git a/app/templates/views/api/whitelist.html b/app/templates/views/api/guest-list.html similarity index 93% rename from app/templates/views/api/whitelist.html rename to app/templates/views/api/guest-list.html index e8fa33977..55745283d 100644 --- a/app/templates/views/api/whitelist.html +++ b/app/templates/views/api/guest-list.html @@ -8,7 +8,7 @@ {% from "components/form.html" import form_wrapper %} {% block service_page_title %} - Whitelist + Guest list {% endblock %} {% block maincolumn_content %} @@ -16,7 +16,7 @@ {% if form.email_addresses.errors or form.phone_numbers.errors %} {% call banner_wrapper(type='dangerous') %}

- There was a problem with your whitelist + There was a problem with your guest list

Fix these errors:

    @@ -34,7 +34,7 @@ {% endcall %} {% else %} {{ page_header( - 'Whitelist', + 'Guest list', back_link=url_for('main.api_integration', service_id=current_service.id) ) }} {% endif %} @@ -42,7 +42,7 @@

    You and members of your team - are included in the whitelist automatically. + are included in the guest list automatically.

    {% call form_wrapper() %} diff --git a/app/templates/views/api/index.html b/app/templates/views/api/index.html index c8cf54694..064dd1202 100644 --- a/app/templates/views/api/index.html +++ b/app/templates/views/api/index.html @@ -19,7 +19,7 @@ API keys
    Callbacks diff --git a/app/templates/views/api/keys.html b/app/templates/views/api/keys.html index b9d0ba773..72b9be879 100644 --- a/app/templates/views/api/keys.html +++ b/app/templates/views/api/keys.html @@ -33,7 +33,7 @@ {% if item.key_type == 'normal' %} Live – sends to anyone {% elif item.key_type == 'team' %} - Team and whitelist – limits who you can send to + Team and guest list – limits who you can send to {% elif item.key_type == 'test' %} Test – pretends to send messages {% endif %} diff --git a/tests/app/main/views/test_add_service.py b/tests/app/main/views/test_add_service.py index 582460468..96147d4db 100644 --- a/tests/app/main/views/test_add_service.py +++ b/tests/app/main/views/test_add_service.py @@ -314,7 +314,7 @@ def test_should_return_form_errors_with_duplicate_service_name_regardless_of_cas ) -def test_non_whitelist_user_cannot_access_create_service_page( +def test_non_government_user_cannot_access_create_service_page( client_request, mock_get_non_govuser, api_nongov_user_active, @@ -327,7 +327,7 @@ def test_non_whitelist_user_cannot_access_create_service_page( ) -def test_non_whitelist_user_cannot_create_service( +def test_non_government_user_cannot_create_service( client_request, mock_get_non_govuser, api_nongov_user_active, diff --git a/tests/app/main/views/test_api_integration.py b/tests/app/main/views/test_api_integration.py index 5b013d84a..c3ecce6c4 100644 --- a/tests/app/main/views/test_api_integration.py +++ b/tests/app/main/views/test_api_integration.py @@ -208,18 +208,18 @@ def test_should_show_api_keys_page( 'Live – sends to anyone ' 'Not available because your service is in trial mode' ), - 'Team and whitelist – limits who you can send to', + 'Team and guest list – limits who you can send to', 'Test – pretends to send messages', ]), (False, False, [ 'Live – sends to anyone', - 'Team and whitelist – limits who you can send to', + 'Team and guest list – limits who you can send to', 'Test – pretends to send messages', ]), (False, True, [ 'Live – sends to anyone', ( - 'Team and whitelist – limits who you can send to ' + 'Team and guest list – limits who you can send to ' 'Cannot be used to send letters' ), 'Test – pretends to send messages', @@ -418,10 +418,10 @@ def test_should_show_whitelist_page( api_user_active, mock_get_service, mock_has_permissions, - mock_get_whitelist, + mock_get_guest_list, ): page = client_request.get( - 'main.whitelist', + 'main.guest_list', service_id=SERVICE_ONE_ID, ) textboxes = page.find_all('input', {'type': 'text'}) @@ -433,7 +433,7 @@ def test_should_show_whitelist_page( def test_should_update_whitelist( client_request, - mock_update_whitelist, + mock_update_guest_list, ): data = OrderedDict([ ('email_addresses-1', 'test@example.com'), @@ -443,23 +443,23 @@ def test_should_update_whitelist( ]) client_request.post( - 'main.whitelist', + 'main.guest_list', service_id=SERVICE_ONE_ID, _data=data, ) - mock_update_whitelist.assert_called_once_with(SERVICE_ONE_ID, { + mock_update_guest_list.assert_called_once_with(SERVICE_ONE_ID, { 'email_addresses': ['test@example.com', 'test@example.com'], 'phone_numbers': ['07900900000', '+1800-555-555']}) def test_should_validate_whitelist_items( client_request, - mock_update_whitelist, + mock_update_guest_list, ): page = client_request.post( - 'main.whitelist', + 'main.guest_list', service_id=SERVICE_ONE_ID, _data=OrderedDict([ ('email_addresses-1', 'abc'), @@ -468,7 +468,7 @@ def test_should_validate_whitelist_items( _expected_status=200, ) - assert page.h1.string.strip() == 'There was a problem with your whitelist' + assert page.h1.string.strip() == 'There was a problem with your guest list' jump_links = page.select('.banner-dangerous a') assert jump_links[0].string.strip() == 'Enter valid email addresses' @@ -477,7 +477,7 @@ def test_should_validate_whitelist_items( assert jump_links[1].string.strip() == 'Enter valid phone numbers' assert jump_links[1]['href'] == '#phone_numbers' - assert mock_update_whitelist.called is False + assert mock_update_guest_list.called is False @pytest.mark.parametrize('endpoint', [ diff --git a/tests/app/main/views/test_forgot_password.py b/tests/app/main/views/test_forgot_password.py index c28c14430..c75f83210 100644 --- a/tests/app/main/views/test_forgot_password.py +++ b/tests/app/main/views/test_forgot_password.py @@ -15,7 +15,7 @@ def test_should_render_forgot_password(client): @pytest.mark.parametrize('email_address', [ 'test@user.gov.uk', - 'someuser@notonwhitelist.com' + 'someuser@notgovernment.com' ]) def test_should_redirect_to_password_reset_sent_for_valid_email( client, diff --git a/tests/app/main/views/test_manage_users.py b/tests/app/main/views/test_manage_users.py index 36095e59b..eeca85f48 100644 --- a/tests/app/main/views/test_manage_users.py +++ b/tests/app/main/views/test_manage_users.py @@ -684,7 +684,7 @@ def test_should_show_folder_permission_form_if_service_has_folder_permissions_en @pytest.mark.parametrize('email_address, gov_user', [ ('test@example.gov.uk', True), - ('test@nonwhitelist.com', False) + ('test@example.com', False) ]) def test_invite_user( client_request, @@ -735,7 +735,7 @@ def test_invite_user( ]) @pytest.mark.parametrize('email_address, gov_user', [ ('test@example.gov.uk', True), - ('test@nonwhitelist.com', False) + ('test@example.com', False) ]) def test_invite_user_with_email_auth_service( client_request, diff --git a/tests/app/notify_client/test_service_api_client.py b/tests/app/notify_client/test_service_api_client.py index 1b5703d56..d3de2c0cf 100644 --- a/tests/app/notify_client/test_service_api_client.py +++ b/tests/app/notify_client/test_service_api_client.py @@ -393,7 +393,7 @@ def test_returns_value_from_cache( (service_api_client, 'suspend_service', [SERVICE_ONE_ID], {}), (service_api_client, 'resume_service', [SERVICE_ONE_ID], {}), (service_api_client, 'remove_user_from_service', [SERVICE_ONE_ID, ''], {}), - (service_api_client, 'update_whitelist', [SERVICE_ONE_ID, {}], {}), + (service_api_client, 'update_guest_list', [SERVICE_ONE_ID, {}], {}), (service_api_client, 'create_service_inbound_api', [SERVICE_ONE_ID] + [''] * 3, {}), (service_api_client, 'update_service_inbound_api', [SERVICE_ONE_ID] + [''] * 4, {}), (service_api_client, 'add_reply_to_email_address', [SERVICE_ONE_ID, ''], {}), diff --git a/tests/conftest.py b/tests/conftest.py index 25b5b083d..daaeec0cb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1152,7 +1152,7 @@ def api_nongov_user_active(fake_uuid): 'id': fake_uuid, 'name': 'Test User', 'password': 'somepassword', - 'email_address': 'someuser@notonwhitelist.com', + 'email_address': 'someuser@example.com', 'mobile_number': '07700 900762', 'state': 'active', 'failed_login_count': 0, @@ -1414,7 +1414,7 @@ def mock_register_user(mocker, api_user_pending): @pytest.fixture(scope='function') def mock_get_non_govuser(mocker, api_user_active): - api_user_active['email_address'] = 'someuser@notonwhitelist.com' + api_user_active['email_address'] = 'someuser@example.com' def _get_user(id_): api_user_active['id'] = id_ @@ -2827,22 +2827,22 @@ def mock_update_email_branding(mocker): @pytest.fixture(scope='function') -def mock_get_whitelist(mocker): - def _get_whitelist(service_id): +def mock_get_guest_list(mocker): + def _get_guest_list(service_id): return { 'email_addresses': ['test@example.com'], 'phone_numbers': ['07900900000'] } return mocker.patch( - 'app.service_api_client.get_whitelist', side_effect=_get_whitelist + 'app.service_api_client.get_guest_list', side_effect=_get_guest_list ) @pytest.fixture(scope='function') -def mock_update_whitelist(mocker): +def mock_update_guest_list(mocker): return mocker.patch( - 'app.service_api_client.update_whitelist' + 'app.service_api_client.update_guest_list' )