Add a page to pick a template to reply with

If your service is receiving inbound messages, you might want to reply
to them. Without an API integration, the only way to do this is by doing
the send one off flow. But currently there is no direct link from the
page which shows the inbound messages.

So this commit:
- adds a link to a new page…
- …which shows the available (ie only text message) templates with which
  you can reply
This commit is contained in:
Chris Hill-Scott
2017-10-15 12:59:36 +01:00
parent 311e4501c2
commit 88f169d970
4 changed files with 135 additions and 0 deletions

View File

@@ -214,3 +214,51 @@ def test_view_conversation_with_empty_inbound(
messages = page.select('.sms-message-wrapper')
assert len(messages) == 1
def test_conversation_links_to_reply(
client_request,
fake_uuid,
mock_get_notification,
mock_get_notifications,
mock_get_inbound_sms,
):
page = client_request.get(
'main.conversation',
service_id=SERVICE_ONE_ID,
notification_id=fake_uuid,
)
assert page.select('main p')[-1].select_one('a')['href'] == (
url_for(
'.conversation_reply',
service_id=SERVICE_ONE_ID,
notification_id=fake_uuid,
)
)
def test_conversation_reply_shows_templates(
client_request,
fake_uuid,
mock_get_service_templates,
):
page = client_request.get(
'main.conversation_reply',
service_id=SERVICE_ONE_ID,
notification_id=fake_uuid,
)
for index, expected in enumerate([
'sms_template_one',
'sms_template_two',
]):
link = page.select('.message-name')[index]
assert normalize_spaces(link.text) == expected
assert link.select_one('a')['href'].startswith(
url_for(
'main.view_template',
service_id=SERVICE_ONE_ID,
template_id='',
)
)