mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 07:28:24 -04:00
Add link back to API integration from callbacks
Matches what we do on the API keys and whitelist pages.
This commit is contained in:
@@ -30,4 +30,8 @@
|
|||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
</div>
|
</div>
|
||||||
|
{{ page_footer(
|
||||||
|
secondary_link=url_for('.api_integration', service_id=current_service.id),
|
||||||
|
secondary_link_text='Back to API integration'
|
||||||
|
) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from app.utils import email_safe
|
|||||||
from tests import validate_route_permission, service_json
|
from tests import validate_route_permission, service_json
|
||||||
from tests.conftest import (
|
from tests.conftest import (
|
||||||
active_user_with_permissions,
|
active_user_with_permissions,
|
||||||
|
active_user_no_api_key_permission,
|
||||||
platform_admin_user,
|
platform_admin_user,
|
||||||
normalize_spaces,
|
normalize_spaces,
|
||||||
multiple_reply_to_email_addresses,
|
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
|
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(
|
def test_empty_letter_contact_block_returns_error(
|
||||||
logged_in_client,
|
logged_in_client,
|
||||||
service_one,
|
service_one,
|
||||||
|
|||||||
@@ -1236,6 +1236,31 @@ def active_user_manage_template_permission(fake_uuid):
|
|||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def active_user_no_api_key_permission(fake_uuid):
|
||||||
|
from app.notify_client.user_api_client import User
|
||||||
|
|
||||||
|
user_data = {
|
||||||
|
'id': fake_uuid,
|
||||||
|
'name': 'Test User With Permissions',
|
||||||
|
'password': 'somepassword',
|
||||||
|
'password_changed_at': str(datetime.utcnow()),
|
||||||
|
'email_address': 'test@user.gov.uk',
|
||||||
|
'mobile_number': '07700 900762',
|
||||||
|
'state': 'active',
|
||||||
|
'failed_login_count': 0,
|
||||||
|
'permissions': {SERVICE_ONE_ID: [
|
||||||
|
'manage_templates',
|
||||||
|
'manage_settings',
|
||||||
|
'view_activity',
|
||||||
|
]},
|
||||||
|
'platform_admin': False,
|
||||||
|
'auth_type': 'sms_auth'
|
||||||
|
}
|
||||||
|
user = User(user_data)
|
||||||
|
return user
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function')
|
@pytest.fixture(scope='function')
|
||||||
def api_user_locked(fake_uuid):
|
def api_user_locked(fake_uuid):
|
||||||
from app.notify_client.user_api_client import User
|
from app.notify_client.user_api_client import User
|
||||||
|
|||||||
Reference in New Issue
Block a user