diff --git a/app/templates/components/api-key.html b/app/templates/components/api-key.html index 81e909d66..dc5e6c2ee 100644 --- a/app/templates/components/api-key.html +++ b/app/templates/components/api-key.html @@ -1,7 +1,9 @@ -{% macro api_key(key, name, thing="API key") %} -

- {{ name }} -

+{% macro api_key(key, name=None, thing="API key") %} + {% if name %} +

+ {{ name }} +

+ {% endif %}
{{ key }}
diff --git a/app/templates/views/service-settings/email_reply_to.html b/app/templates/views/service-settings/email_reply_to.html index 99b49b82a..b5efa04a7 100644 --- a/app/templates/views/service-settings/email_reply_to.html +++ b/app/templates/views/service-settings/email_reply_to.html @@ -1,5 +1,5 @@ {% extends "withnav_template.html" %} -{% from "components/textbox.html" import textbox %} +{% from "components/api-key.html" import api_key %} {% from "components/page-footer.html" import page_footer %} {% from "components/table.html" import row_group, row, text_field, edit_field, field, boolean_field, list_table %} @@ -19,28 +19,29 @@ Add email address -
- {% call(item, row_number) list_table( - reply_to_email_addresses, - empty_message="You haven’t added any email reply to addresses yet", - caption="Reply to email addresses", - caption_visible=false, - field_headings=[ - 'Email addresses', - 'Action' - ], - field_headings_visible=False - ) %} - {% call field() %} - {{ item.email_address }} - {% if item.is_default %} - - {{ "(default)" }} - - {% endif %} - {% endcall %} - {{ edit_field('Change', url_for('.service_edit_email_reply_to', service_id =current_service.id, reply_to_email_id = item.id)) }} - {% endcall %} +
+ {% if not reply_to_email_addresses %} +
+ You haven’t added any email reply to addresses yet +
+ {% endif %} + {% for item in reply_to_email_addresses %} +
+

+ {{ item.email_address }} + {%- if item.is_default -%} + (default) + {% endif %} + +

+ + {{ api_key(item.id, thing="ID") }} +
+ {% endfor %}
diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 906ee0bf2..439feb14a 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -693,28 +693,32 @@ def test_default_email_reply_to_address_has_default_hint( client_request, multiple_reply_to_email_addresses ): - page = client_request.get( + rows = client_request.get( 'main.service_email_reply_to', service_id=SERVICE_ONE_ID + ).select( + '.user-list-item' ) - assert normalize_spaces(page.select('tbody tr')[0].text) == "test@example.com (default) Change" - assert normalize_spaces(page.select('tbody tr')[1].text) == "test2@example.com Change" - assert normalize_spaces(page.select('tbody tr')[2].text) == "test3@example.com Change" - assert len(page.select('tbody tr')) == 3 + assert normalize_spaces(rows[0].text) == "test@example.com (default) Change 1234" + assert normalize_spaces(rows[1].text) == "test2@example.com Change 5678" + assert normalize_spaces(rows[2].text) == "test3@example.com Change 9457" + assert len(rows) == 3 def test_no_reply_to_email_addresses_message_shows( client_request, no_reply_to_email_addresses ): - page = client_request.get( + rows = client_request.get( 'main.service_email_reply_to', service_id=SERVICE_ONE_ID + ).select( + '.user-list-item' ) - assert normalize_spaces(page.select('tbody tr')[0].text) == "You haven’t added any email reply to addresses yet" - assert len(page.select('tbody tr')) == 1 + assert normalize_spaces(rows[0].text) == "You haven’t added any email reply to addresses yet" + assert len(rows) == 1 @pytest.mark.parametrize('reply_to_input, expected_error', [