Add link back to API integration from callbacks

Matches what we do on the API keys and whitelist pages.
This commit is contained in:
Chris Hill-Scott
2018-01-11 17:22:27 +00:00
parent b3673a94a2
commit 67b54d850f
3 changed files with 65 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ from app.utils import email_safe
from tests import validate_route_permission, service_json
from tests.conftest import (
active_user_with_permissions,
active_user_no_api_key_permission,
platform_admin_user,
normalize_spaces,
multiple_reply_to_email_addresses,
@@ -1927,6 +1928,41 @@ def test_set_inbound_sms_when_inbound_number_is_not_set(
assert response.status_code == 200
@pytest.mark.parametrize('user, expected_paragraphs', [
(active_user_with_permissions, [
'Your service can receive text messages sent to 07700900123.',
'If you want to turn this feature off, get in touch with the GOV.UK Notify team.',
'You can set up callbacks for received text messages on the API integration page.',
]),
(active_user_no_api_key_permission, [
'Your service can receive text messages sent to 07700900123.',
'If you want to turn this feature off, get in touch with the GOV.UK Notify team.',
]),
])
def test_set_inbound_sms_when_inbound_number_is_set(
client,
service_one,
mocker,
fake_uuid,
user,
expected_paragraphs,
):
service_one['permissions'] = ['inbound_sms']
mocker.patch('app.inbound_number_client.get_inbound_sms_number_for_service', return_value={
'data': {'number': '07700900123'}
})
client.login(user(fake_uuid), mocker, service_one)
response = client.get(url_for(
'main.service_set_inbound_sms', service_id=SERVICE_ONE_ID
))
paragraphs = BeautifulSoup(response.data.decode('utf-8'), 'html.parser').select('main p')
assert len(paragraphs) == len(expected_paragraphs)
for index, p in enumerate(expected_paragraphs):
assert normalize_spaces(paragraphs[index].text) == p
def test_empty_letter_contact_block_returns_error(
logged_in_client,
service_one,