+
+
+
+
+
{{ ajax_block(
partials,
url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status, page=page),
From ebd5721d42cdbcf9fe6237e56b196fedcce7d967 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 11 Jan 2018 17:33:04 +0000
Subject: [PATCH 06/12] Correct description of how service name appears
This has changed since we made prefixing text messages its own setting.
---
.../views/service-settings/name.html | 15 ++++++-----
tests/app/main/views/test_service_settings.py | 25 +++++++++++++------
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/app/templates/views/service-settings/name.html b/app/templates/views/service-settings/name.html
index 419cd7d03..223d079e9 100644
--- a/app/templates/views/service-settings/name.html
+++ b/app/templates/views/service-settings/name.html
@@ -10,13 +10,16 @@
Change your service name
-
-
Users will see your service name:
-
-
at the start of every text message, eg ‘Vehicle tax: we received your payment, thank you’
-
as your email sender name
-
+ {% if current_service.prefix_sms %}
+
Users will see your service name:
+
+
at the start of every text message, eg ‘{{ current_service.name }}: This is an example message’
+
as your email sender name
+
+ {% else %}
+
Users will see your service name as your email sender name.
+ {% endif %}
+ {% else %}
+
{% endif %}
From b3673a94a26162b7bd0e8b339fe396779fda0a3e Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 11 Jan 2018 17:20:21 +0000
Subject: [PATCH 08/12] Link to callbacks from inbound page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If you’ve got an inbound number and are using the API you’ll probably
be interested in this new feature we’ve got. And if you do know about
it, you might not be able to find it because we’ve moved it.
---
app/templates/views/service-settings/set-inbound-sms.html | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/templates/views/service-settings/set-inbound-sms.html b/app/templates/views/service-settings/set-inbound-sms.html
index 6fef29a27..bc6459783 100644
--- a/app/templates/views/service-settings/set-inbound-sms.html
+++ b/app/templates/views/service-settings/set-inbound-sms.html
@@ -19,6 +19,12 @@
If you want to turn this feature off,
get in touch with the GOV.UK Notify team.
+ {% if current_user.has_permissions(['manage_api_keys'], admin_override=True) %}
+
+ You can set up callbacks for received text messages on the
+ API integration page.
+
+ {% endif %}
{% else %}
Receiving text messages from your users is an
From 67b54d850f4aa20b72b756299b07446741cefa51 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 11 Jan 2018 17:22:27 +0000
Subject: [PATCH 09/12] Add link back to API integration from callbacks
Matches what we do on the API keys and whitelist pages.
---
app/templates/views/api/callbacks.html | 4 +++
tests/app/main/views/test_service_settings.py | 36 +++++++++++++++++++
tests/conftest.py | 25 +++++++++++++
3 files changed, 65 insertions(+)
diff --git a/app/templates/views/api/callbacks.html b/app/templates/views/api/callbacks.html
index 54a86bafe..126342b37 100644
--- a/app/templates/views/api/callbacks.html
+++ b/app/templates/views/api/callbacks.html
@@ -30,4 +30,8 @@
{% endcall %}
{% endcall %}
+ {{ page_footer(
+ secondary_link=url_for('.api_integration', service_id=current_service.id),
+ secondary_link_text='Back to API integration'
+ ) }}
{% endblock %}
diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py
index 3d3ed2cb3..237fe1e42 100644
--- a/tests/app/main/views/test_service_settings.py
+++ b/tests/app/main/views/test_service_settings.py
@@ -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,
diff --git a/tests/conftest.py b/tests/conftest.py
index b6bd4030b..67e99d810 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1236,6 +1236,31 @@ def active_user_manage_template_permission(fake_uuid):
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')
def api_user_locked(fake_uuid):
from app.notify_client.user_api_client import User
From b4435e5b7f709218b852a7872a6cda27c74de8b0 Mon Sep 17 00:00:00 2001
From: pyup-bot
Date: Thu, 11 Jan 2018 20:26:25 +0000
Subject: [PATCH 10/12] Update pytest-xdist from 1.21.0 to 1.22.0
---
requirements_for_test.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements_for_test.txt b/requirements_for_test.txt
index 7e0d0651e..5ed459a80 100644
--- a/requirements_for_test.txt
+++ b/requirements_for_test.txt
@@ -2,7 +2,7 @@
pytest==3.3.2
pytest-mock==1.6.3
pytest-cov==2.5.1
-pytest-xdist==1.21.0
+pytest-xdist==1.22.0
coveralls==1.2.0
httpretty==0.8.14
beautifulsoup4==4.6.0
From b79cd42110dd02871161b6d8cabe289fe46c7ebd Mon Sep 17 00:00:00 2001
From: pyup-bot
Date: Thu, 11 Jan 2018 21:24:17 +0000
Subject: [PATCH 11/12] Update pyexcel-io from 0.5.5 to 0.5.6
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 6bb28a328..ef2d82f87 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,7 +6,7 @@ Flask-Login==0.4.1
boto3==1.5.12
blinker==1.4
pyexcel==0.5.6
-pyexcel-io==0.5.5
+pyexcel-io==0.5.6
pyexcel-xls==0.5.5
pyexcel-xlsx==0.5.5
pyexcel-ods3==0.5.2
From a914c2e783cbe25f815c84174de540b13fa7f2ae Mon Sep 17 00:00:00 2001
From: pyup-bot
Date: Thu, 11 Jan 2018 21:38:23 +0000
Subject: [PATCH 12/12] Update pyexcel from 0.5.6 to 0.5.7
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index ef2d82f87..e7af49127 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,7 +5,7 @@ Flask-Login==0.4.1
boto3==1.5.12
blinker==1.4
-pyexcel==0.5.6
+pyexcel==0.5.7
pyexcel-io==0.5.6
pyexcel-xls==0.5.5
pyexcel-xlsx==0.5.5