From 18e3eb6b3295a319f788e9060b2840eda874d048 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Fri, 13 Sep 2019 16:00:56 +0100 Subject: [PATCH] Update tests for content changes. --- app/main/validators.py | 6 +- app/main/views/platform_admin.py | 2 +- tests/app/main/test_placeholder_form.py | 8 +- tests/app/main/views/test_api_integration.py | 4 +- tests/app/main/views/test_manage_users.py | 100 +++++++++--------- tests/app/main/views/test_platform_admin.py | 2 +- tests/app/main/views/test_register.py | 2 +- tests/app/main/views/test_service_settings.py | 12 +-- tests/app/main/views/test_templates.py | 4 +- 9 files changed, 70 insertions(+), 70 deletions(-) diff --git a/app/main/validators.py b/app/main/validators.py index 9e432ad96..014cae95e 100644 --- a/app/main/validators.py +++ b/app/main/validators.py @@ -71,7 +71,7 @@ class ValidEmail(Email): class NoCommasInPlaceHolders: - def __init__(self, message='You can’t put commas between double brackets'): + def __init__(self, message='You cannot put commas between double brackets'): self.message = message def __call__(self, form, field): @@ -84,7 +84,7 @@ class OnlySMSCharacters: non_sms_characters = sorted(list(SanitiseSMS.get_non_compatible_characters(field.data))) if non_sms_characters: raise ValidationError( - 'You can’t use {} in text messages. {} will not show up properly on everyone’s phones.'.format( + 'You cannot use {} in text messages. {} will not show up properly on everyone’s phones.'.format( formatted_list(non_sms_characters, conjunction='or', before_each='', after_each=''), ('It' if len(non_sms_characters) == 1 else 'They') ) @@ -105,7 +105,7 @@ class LettersNumbersAndFullStopsOnly: class DoesNotStartWithDoubleZero: - def __init__(self, message="Can't start with 00"): + def __init__(self, message="Cannot start with 00"): self.message = message def __call__(self, form, field): diff --git a/app/main/views/platform_admin.py b/app/main/views/platform_admin.py index 70078c045..69866bc75 100644 --- a/app/main/views/platform_admin.py +++ b/app/main/views/platform_admin.py @@ -410,7 +410,7 @@ def letter_validation_preview(from_platform_admin): if not virus_free: return render_template( view_location, - form=form, message="Document didn't pass the virus scan", pages=pages, result=result + form=form, message="Document did not pass the virus scan", pages=pages, result=result ), 400 try: diff --git a/tests/app/main/test_placeholder_form.py b/tests/app/main/test_placeholder_form.py index 4482d4fc8..9771c98a5 100644 --- a/tests/app/main/test_placeholder_form.py +++ b/tests/app/main/test_placeholder_form.py @@ -21,13 +21,13 @@ def test_form_class_not_mutated(app_): @pytest.mark.parametrize('service_can_send_international_sms, placeholder_name, template_type, value, expected_error', [ - (False, 'email address', 'email', '', 'Can’t be empty'), + (False, 'email address', 'email', '', 'Cannot be empty'), (False, 'email address', 'email', '12345', 'Enter a valid email address'), (False, 'email address', 'email', '“bad”@email-address.com', 'Enter a valid email address'), (False, 'email address', 'email', 'test@example.com', None), (False, 'email address', 'email', 'test@example.gov.uk', None), - (False, 'phone number', 'sms', '', 'Can’t be empty'), + (False, 'phone number', 'sms', '', 'Cannot be empty'), (False, 'phone number', 'sms', '+1-2345-678890', 'Not a UK mobile number'), (False, 'phone number', 'sms', '07900900123', None), (False, 'phone number', 'sms', '+44(0)7900 900-123', None), @@ -36,8 +36,8 @@ def test_form_class_not_mutated(app_): (True, 'phone number', 'sms', '+44(0)7900 900-123', None), (True, 'phone number', 'sms', '+1-2345-678890', None), - (False, 'anything else', 'sms', '', 'Can’t be empty'), - (False, 'anything else', 'email', '', 'Can’t be empty'), + (False, 'anything else', 'sms', '', 'Cannot be empty'), + (False, 'anything else', 'email', '', 'Cannot be empty'), (True, 'phone number', 'sms', 'invalid', 'Must not contain letters or symbols'), (True, 'phone number', 'email', 'invalid', None), diff --git a/tests/app/main/views/test_api_integration.py b/tests/app/main/views/test_api_integration.py index 0f86fd385..8ebdc905c 100644 --- a/tests/app/main/views/test_api_integration.py +++ b/tests/app/main/views/test_api_integration.py @@ -228,7 +228,7 @@ def test_should_show_api_keys_page( 'Live – sends to anyone', ( 'Team and whitelist – limits who you can send to ' - 'Can’t be used to send letters' + 'Cannot be used to send letters' ), 'Test – pretends to send messages', ]), @@ -487,7 +487,7 @@ def test_should_validate_whitelist_items( ('main.received_text_messages_callback'), ]) @pytest.mark.parametrize('url, bearer_token, expected_errors', [ - ("https://example.com", "", "Can’t be empty"), + ("https://example.com", "", "Cannot be empty"), ("http://not_https.com", "1234567890", "Must be a valid https URL"), ("https://test.com", "123456789", "Must be at least 10 characters"), ]) diff --git a/tests/app/main/views/test_manage_users.py b/tests/app/main/views/test_manage_users.py index 3efbfd1d4..8d04e5e84 100644 --- a/tests/app/main/views/test_manage_users.py +++ b/tests/app/main/views/test_manage_users.py @@ -35,10 +35,10 @@ from tests.conftest import ( ( 'ZZZZZZZZ zzzzzzz@example.gov.uk ' 'Can See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration ' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration ' 'Change details' ) ), @@ -46,19 +46,19 @@ from tests.conftest import ( active_user_empty_permissions, ( 'Test User With Empty Permissions (you) ' - 'Can’t See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot See dashboard ' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ), ( 'ZZZZZZZZ zzzzzzz@example.gov.uk ' 'Can See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ), ), ( @@ -66,18 +66,18 @@ from tests.conftest import ( ( 'Test User With Permissions (you) ' 'Can See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ), ( 'ZZZZZZZZ zzzzzzz@example.gov.uk ' 'Can See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ) ), ( @@ -85,18 +85,18 @@ from tests.conftest import ( ( 'Test User With Permissions (you) ' 'Can See dashboard ' - 'Can’t Send messages ' + 'Cannot Send messages ' 'Can Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ), ( 'ZZZZZZZZ zzzzzzz@example.gov.uk ' 'Can See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ) ), ( @@ -104,18 +104,18 @@ from tests.conftest import ( ( 'Test User With Permissions (you) ' 'Can See dashboard ' - 'Can’t Send messages ' + 'Cannot Send messages ' 'Can Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ), ( 'ZZZZZZZZ zzzzzzz@example.gov.uk ' 'Can See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ) ), ]) @@ -178,19 +178,19 @@ def test_should_show_caseworker_on_overview_page( assert normalize_spaces(page.select('.user-list-item')[0].text) == ( 'Test User With Permissions (you) ' 'Can See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ) # [1:5] are invited users assert normalize_spaces(page.select('.user-list-item')[6].text) == ( 'Test User zzzzzzz@example.gov.uk ' - 'Can’t See dashboard ' + 'Cannot See dashboard ' 'Can Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' ) @@ -829,7 +829,7 @@ def test_cancel_invited_user_doesnt_work_if_user_not_invited_to_this_service( 'invited_user@test.gov.uk (invited) ' 'Can See dashboard ' 'Can Send messages ' - 'Can’t Add and edit templates ' + 'Cannot Add and edit templates ' 'Can Manage settings, team and usage ' 'Can Manage API integration ' 'Cancel invitation' @@ -837,11 +837,11 @@ def test_cancel_invited_user_doesnt_work_if_user_not_invited_to_this_service( ('cancelled', ( 'invited_user@test.gov.uk (cancelled invite) ' # all permissions are greyed out - 'Can’t See dashboard ' - 'Can’t Send messages ' - 'Can’t Add and edit templates ' - 'Can’t Manage settings, team and usage ' - 'Can’t Manage API integration' + 'Cannot See dashboard ' + 'Cannot Send messages ' + 'Cannot Add and edit templates ' + 'Cannot Manage settings, team and usage ' + 'Cannot Manage API integration' )), ]) def test_manage_users_shows_invited_user( @@ -904,7 +904,7 @@ def test_user_cant_invite_themselves( ) assert page.h1.string.strip() == 'Invite a team member' form_error = page.find('span', class_='error-message').string.strip() - assert form_error == "You can’t send an invitation to yourself" + assert form_error == "You cannot send an invitation to yourself" assert not mock_create_invite.called diff --git a/tests/app/main/views/test_platform_admin.py b/tests/app/main/views/test_platform_admin.py index 241523dea..7e58dac2a 100644 --- a/tests/app/main/views/test_platform_admin.py +++ b/tests/app/main/views/test_platform_admin.py @@ -826,7 +826,7 @@ def test_letter_validation_preview_doesnt_call_template_preview_when_file_doesnt validate_letter.assert_not_called() page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - assert page.find('div', class_='banner-dangerous').text.strip() == "Document didn't pass the virus scan" + assert page.find('div', class_='banner-dangerous').text.strip() == "Document did not pass the virus scan" def test_clear_cache_shows_form(client_request, platform_admin_user, mocker): diff --git a/tests/app/main/views/test_register.py b/tests/app/main/views/test_register.py index ae8d84bd0..fdb4a4e6f 100644 --- a/tests/app/main/views/test_register.py +++ b/tests/app/main/views/test_register.py @@ -405,7 +405,7 @@ def test_cannot_register_with_sms_auth_and_missing_mobile_number( assert response.status_code == 200 page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') err = page.select_one('.error-message') - assert err.text.strip() == 'Can’t be empty' + assert err.text.strip() == 'Cannot be empty' assert err.attrs['data-error-label'] == 'mobile_number' diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 010e4c730..755b81d9b 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -2055,7 +2055,7 @@ def test_no_senders_message_shows( @pytest.mark.parametrize('reply_to_input, expected_error', [ - ('', 'Can’t be empty'), + ('', 'Cannot be empty'), ('testtest', 'Enter a valid email address'), ]) def test_incorrect_reply_to_email_address_input( @@ -2075,7 +2075,7 @@ def test_incorrect_reply_to_email_address_input( @pytest.mark.parametrize('contact_block_input, expected_error', [ - ('', 'Can’t be empty'), + ('', 'Cannot be empty'), ('1 \n 2 \n 3 \n 4 \n 5 \n 6 \n 7 \n 8 \n 9 \n 0 \n a', 'Contains 11 lines, maximum is 10') ]) def test_incorrect_letter_contact_block_input( @@ -2097,11 +2097,11 @@ def test_incorrect_letter_contact_block_input( @pytest.mark.parametrize('sms_sender_input, expected_error', [ ('elevenchars', None), ('11 chars', None), - ('', 'Can’t be empty'), + ('', 'Cannot be empty'), ('abcdefghijkhgkg', 'Enter 11 characters or fewer'), (r' ¯\_(ツ)_/¯ ', 'Use letters and numbers only'), ('blood.co.uk', None), - ('00123', "Can't start with 00") + ('00123', "Cannot start with 00") ]) def test_incorrect_sms_sender_input( sms_sender_input, @@ -2845,7 +2845,7 @@ def test_inbound_sms_sender_is_not_editable( if hide_textbox: assert normalize_spaces( page.select_one('form[method="post"] p').text - ) == "GOVUK This phone number receives replies and can’t be changed" + ) == "GOVUK This phone number receives replies and cannot be changed" def test_shows_research_mode_indicator( @@ -4257,7 +4257,7 @@ def test_empty_letter_contact_block_returns_error( _expected_status=200, ) error_message = page.find('span', class_='error-message').text.strip() - assert error_message == 'Can’t be empty' + assert error_message == 'Cannot be empty' def test_show_sms_prefixing_setting_page( diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index a708d4dd5..b9e0c041e 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -1934,7 +1934,7 @@ def test_should_not_create_sms_template_with_emoji( }, _expected_status=200, ) - assert "You can’t use 🍜 in text messages." in page.text + assert "You cannot use 🍜 in text messages." in page.text assert mock_create_service_template.called is False @@ -1958,7 +1958,7 @@ def test_should_not_update_sms_template_with_emoji( }, _expected_status=200, ) - assert "You can’t use 🍔 in text messages." in page.text + assert "You cannot use 🍔 in text messages." in page.text assert mock_update_service_template.called is False