Change content for email reply-to verification journey

Earlier commits used placeholder content while awaiting official
content.
This commit is contained in:
Pea Tyczynska
2019-05-23 15:34:24 +01:00
parent 441c1f441b
commit 3251fc4e00
4 changed files with 29 additions and 15 deletions
+6 -2
View File
@@ -422,7 +422,9 @@ def service_add_email_reply_to(service_id):
'.service_verify_reply_to_address', '.service_verify_reply_to_address',
service_id=service_id, service_id=service_id,
notification_id=notification_id notification_id=notification_id
) + "?is_default={}".format(is_default)) ) + "?is_default={}".format(is_default)
+ "&is_new=True"
)
return render_template( return render_template(
'views/service-settings/email-reply-to/add.html', 'views/service-settings/email-reply-to/add.html',
@@ -434,11 +436,13 @@ def service_add_email_reply_to(service_id):
@login_required @login_required
@user_has_permissions('manage_service') @user_has_permissions('manage_service')
def service_verify_reply_to_address(service_id, notification_id): def service_verify_reply_to_address(service_id, notification_id):
is_new = request.args.get('is_new', False)
return render_template( return render_template(
'views/service-settings/email-reply-to/verify.html', 'views/service-settings/email-reply-to/verify.html',
service_id=service_id, service_id=service_id,
notification_id=notification_id, notification_id=notification_id,
partials=get_service_verify_reply_to_address_partials(service_id, notification_id) partials=get_service_verify_reply_to_address_partials(service_id, notification_id),
verb=("Add" if is_new else "Change")
) )
@@ -1,22 +1,31 @@
{% from "components/banner.html" import banner %} {% from "components/banner.html" import banner, banner_wrapper %}
<div class="ajax-block-container"> <div class="ajax-block-container">
{% if verification_status == "pending" %} {% if verification_status == "pending" %}
<p> <p>
We have sent a notification to {{ reply_to_email_address }} to check if it's a working email address. Were checking that {{ reply_to_email_address }} is a real email address.
</p> </p>
<p> <p>
Once we receive a delivery confirmation, we will update your list of reply-to email addresses. <span class='loading-indicator'>This can take a minute </span>
</p> </p>
<p> <p>
<a href="{{ url_for('main.service_verify_reply_to_address', service_id=service_id, notification_id=notification_id) + "?is_default={}".format(is_default) }}"">Refresh</a> <a href="{{ url_for('main.service_verify_reply_to_address', service_id=service_id, notification_id=notification_id) + "?is_default={}".format(is_default) }}"">Refresh</a>
</p> </p>
{% elif verification_status == "success" %} {% elif verification_status == "success" %}
{{ banner("Yay success! Your new reply-to email has been added ^__^", type='default', with_tick=True) }} {{ banner("{} is ready to use".format(reply_to_email_address), type='default', with_tick=True) }}
{% elif verification_status == "failure" %} {% elif verification_status == "failure" %}
{{ banner("Sorry dawg, this email address doesn't seem to be working :d", type='dangerous') }} {% call banner_wrapper(type='dangerous') %}
<h2 class='banner-title' data-module="track-error" data-error-type="reply-to-email-not-working" data-error-label="{{ upload_id }}">
Theres a problem with your reply-to address
</h2>
<p>
We sent an email to {{ reply_to_email_address }} but it wasnt delivered.
</p>
<p>
You can try again, or use a different address.
</p>
{% endcall %}
<a href={{ url_for('main.service_add_email_reply_to', service_id=service_id) }}>Try again</a> <a href={{ url_for('main.service_add_email_reply_to', service_id=service_id) }}>Try again</a>
{% endif %} {% endif %}
</div> </div>
@@ -7,13 +7,13 @@
{% from "components/ajax-block.html" import ajax_block %} {% from "components/ajax-block.html" import ajax_block %}
{% block service_page_title %} {% block service_page_title %}
Verifying your reply-to email address {{ verb }} email reply-to address
{% endblock %} {% endblock %}
{% block maincolumn_content %} {% block maincolumn_content %}
{{ page_header( {{ page_header(
'Verifying your reply-to email address', '{} email reply-to address'.format(verb),
back_link=url_for('main.service_email_reply_to', service_id=current_service.id) back_link=url_for('main.service_email_reply_to', service_id=current_service.id)
) }} ) }}
{{ ajax_block( {{ ajax_block(
@@ -2026,11 +2026,12 @@ def test_add_reply_to_email_address_sends_test_notification(
notification_id="123", notification_id="123",
_external=True, _external=True,
) + "?is_default={}".format(api_default_args) ) + "?is_default={}".format(api_default_args)
+ "&is_new=True"
) )
mock_verify.assert_called_once_with(SERVICE_ONE_ID, "test@example.com") mock_verify.assert_called_once_with(SERVICE_ONE_ID, "test@example.com")
@pytest.mark.parametrize("is_default", [True, False]) @pytest.mark.parametrize("is_default,is_new,expected_header", [(True, "&is_new=True", "Add"), (False, "", "Change")])
@pytest.mark.parametrize("status,expected_failure,expected_success", [ @pytest.mark.parametrize("status,expected_failure,expected_success", [
("delivered", 0, 1), ("delivered", 0, 1),
("sending", 0, 0), ("sending", 0, 0),
@@ -2038,7 +2039,7 @@ def test_add_reply_to_email_address_sends_test_notification(
]) ])
@freeze_time("2018-06-01 11:11:00.061258") @freeze_time("2018-06-01 11:11:00.061258")
def test_service_verify_reply_to_address( def test_service_verify_reply_to_address(
mocker, client_request, fake_uuid, status, expected_failure, expected_success, is_default mocker, client_request, fake_uuid, status, expected_failure, expected_success, is_default, is_new, expected_header
): ):
notification = { notification = {
"id": fake_uuid, "id": fake_uuid,
@@ -2058,9 +2059,9 @@ def test_service_verify_reply_to_address(
'main.service_verify_reply_to_address', 'main.service_verify_reply_to_address',
service_id=SERVICE_ONE_ID, service_id=SERVICE_ONE_ID,
notification_id=notification["id"], notification_id=notification["id"],
_optional_args="?is_default={}".format(is_default) _optional_args="?is_default={}{}".format(is_default, is_new)
) )
assert page.find('h1').text == 'Verifying your reply-to email address' assert page.find('h1').text == '{} email reply-to address'.format(expected_header)
assert len(page.find_all('div', class_='banner-dangerous')) == expected_failure assert len(page.find_all('div', class_='banner-dangerous')) == expected_failure
assert len(page.find_all('div', class_='banner-default-with-tick')) == expected_success assert len(page.find_all('div', class_='banner-default-with-tick')) == expected_success
@@ -2096,7 +2097,7 @@ def test_add_reply_to_email_address_fails_if_notification_not_delivered_in_5_min
_optional_args="?is_default={}".format(False) _optional_args="?is_default={}".format(False)
) )
expected_banner = page.find_all('div', class_='banner-dangerous')[0] expected_banner = page.find_all('div', class_='banner-dangerous')[0]
assert expected_banner.text.strip() == "Sorry dawg, this email address doesn't seem to be working :d" assert 'Theres a problem with your reply-to address' in expected_banner.text.strip()
mock_add_reply_to_email_address.assert_not_called() mock_add_reply_to_email_address.assert_not_called()