Show try again link when email verification fails

This commit is contained in:
Pea Tyczynska
2019-05-14 15:05:52 +01:00
parent ed599f0c03
commit 9d2b60b56b
2 changed files with 8 additions and 31 deletions

View File

@@ -31,5 +31,6 @@
{{ banner("Yay success! Your new reply-to email has been added ^__^", type='message', with_tick=True) }} {{ banner("Yay success! Your new reply-to email has been added ^__^", type='message', 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') }} {{ banner("Sorry dawg, this email address doesn't seem to be working :d", type='dangerous') }}
<a href={{ url_for('main.service_add_email_reply_to', service_id=service_id) }}>Try again</a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@@ -2003,34 +2003,6 @@ def test_incorrect_sms_sender_input(
assert count_of_api_calls == 0 assert count_of_api_calls == 0
@pytest.mark.parametrize('fixture, data, api_default_args', [
(no_reply_to_email_addresses, {}, True),
(multiple_reply_to_email_addresses, {}, False),
(multiple_reply_to_email_addresses, {"is_default": "y"}, True)
])
def test_add_reply_to_email_address(
fixture,
data,
api_default_args,
mocker,
client_request,
mock_add_reply_to_email_address
):
fixture(mocker)
data['email_address'] = "test@example.com"
client_request.post(
'main.service_add_email_reply_to',
service_id=SERVICE_ONE_ID,
_data=data
)
mock_add_reply_to_email_address.assert_called_once_with(
SERVICE_ONE_ID,
email_address="test@example.com",
is_default=api_default_args
)
@pytest.mark.parametrize('fixture, data, api_default_args', [ @pytest.mark.parametrize('fixture, data, api_default_args', [
(no_reply_to_email_addresses, {}, True), (no_reply_to_email_addresses, {}, True),
(multiple_reply_to_email_addresses, {}, False), (multiple_reply_to_email_addresses, {}, False),
@@ -2052,18 +2024,18 @@ def test_add_reply_to_email_address_sends_test_notification(
service_id=SERVICE_ONE_ID, service_id=SERVICE_ONE_ID,
notification_id="123", notification_id="123",
_external=True, _external=True,
) ) + "?is_default={}".format(api_default_args)
) )
mock_verify.assert_called_once_with("test@example.com") mock_verify.assert_called_once_with("test@example.com")
@pytest.mark.parametrize("is_default", ["True", "False"]) @pytest.mark.parametrize("is_default", [True, False])
@pytest.mark.parametrize("status,expected_failure,expected_success", [ @pytest.mark.parametrize("status,expected_failure,expected_success", [
("delivered", 0, 1), ("delivered", 0, 1),
("pending", 0, 0), ("pending", 0, 0),
("permanent-failure", 1, 0), ("permanent-failure", 1, 0),
]) ])
def test_add_reply_to_email_address_waiting_page( def test_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
): ):
notification = { notification = {
@@ -2092,6 +2064,10 @@ def test_add_reply_to_email_address_waiting_page(
) )
else: else:
mock_add_reply_to_email_address.assert_not_called() mock_add_reply_to_email_address.assert_not_called()
if status == "permanent-failure":
assert page.find('a', text='Try again').attrs["href"] == url_for(
'main.service_add_email_reply_to', service_id=SERVICE_ONE_ID
)
def test_add_reply_to_email_address_success(): def test_add_reply_to_email_address_success():