reformatted

This commit is contained in:
Beverly Nguyen
2025-05-14 10:08:02 -07:00
parent 3f944e2447
commit 8aa7a63f55
4 changed files with 31 additions and 27 deletions

View File

@@ -566,18 +566,18 @@ def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs):
"url": url_for( "url": url_for(
"main.send_one_off", service_id=service_id, template_id=template.id "main.send_one_off", service_id=service_id, template_id=template.id
), ),
"text": "Back to message personalization" "text": "Back to message personalization",
}, },
"html": "Back to message personalization" "html": "Back to message personalization",
} }
back_link_from_preview = { back_link_from_preview = {
"href": { "href": {
"url": url_for( "url": url_for(
"main.send_one_off", service_id=service_id, template_id=template.id "main.send_one_off", service_id=service_id, template_id=template.id
), ),
"text": "Back to message personalization" "text": "Back to message personalization",
}, },
"html": "Back to message personalization" "html": "Back to message personalization",
} }
choose_time_form = None choose_time_form = None
else: else:
@@ -586,9 +586,9 @@ def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs):
"url": url_for( "url": url_for(
"main.send_messages", service_id=service_id, template_id=template.id "main.send_messages", service_id=service_id, template_id=template.id
), ),
"text": "Back to upload a file" "text": "Back to upload a file",
}, },
"html": "Back to upload a file" "html": "Back to upload a file",
} }
back_link_from_preview = { back_link_from_preview = {
"href": { "href": {
@@ -598,9 +598,9 @@ def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs):
template_id=template.id, template_id=template.id,
upload_id=upload_id, upload_id=upload_id,
), ),
"text": "Back to check messages" "text": "Back to check messages",
}, },
"html": "Back to check messages" "html": "Back to check messages",
} }
choose_time_form = ChooseTimeForm() choose_time_form = ChooseTimeForm()
@@ -786,9 +786,9 @@ def get_back_link(
service_id=service_id, service_id=service_id,
template_id=template.id, template_id=template.id,
), ),
"text": "Back to select delivery time" "text": "Back to select delivery time",
}, },
"html": "Back to select delivery time" "html": "Back to select delivery time",
} }
if step_index == 0: if step_index == 0:
@@ -799,9 +799,9 @@ def get_back_link(
".choose_template", ".choose_template",
service_id=service_id, service_id=service_id,
), ),
"text": "Back to all templates" "text": "Back to all templates",
}, },
"html": "Back to all templates" "html": "Back to all templates",
} }
else: else:
return { return {
@@ -811,14 +811,16 @@ def get_back_link(
service_id=service_id, service_id=service_id,
template_id=template.id, template_id=template.id,
), ),
"text": "Back to confirm your template" "text": "Back to confirm your template",
}, },
"html": "Back to confirm your template" "html": "Back to confirm your template",
} }
# fallback for other steps # fallback for other steps
back_to_text = ( back_to_text = (
"Back to select recipients" if step_index == 1 else "Back to message personalization" "Back to select recipients"
if step_index == 1
else "Back to message personalization"
) )
return { return {
@@ -829,9 +831,9 @@ def get_back_link(
template_id=template.id, template_id=template.id,
step_index=step_index - 1, step_index=step_index - 1,
), ),
"text": back_to_text "text": back_to_text,
}, },
"html": back_to_text "html": back_to_text,
} }

View File

@@ -142,13 +142,11 @@ def _get_tour_step_back_link(service_id, template_id, step_index):
return { return {
"href": { "href": {
"url": url_for( "url": url_for(
'main.begin_tour', "main.begin_tour", service_id=service_id, template_id=template_id
service_id=service_id,
template_id=template_id
), ),
"text": "Back to tour start" "text": "Back to tour start",
}, },
"html": "Back to tour start" "html": "Back to tour start",
} }
else: else:
return { return {
@@ -207,9 +205,9 @@ def check_tour_notification(service_id, template_id):
template_id=template_id, template_id=template_id,
step_index=len(placeholders), step_index=len(placeholders),
), ),
"text": "Back to previous step" "text": "Back to previous step",
}, },
"html": "Back to previous step" "html": "Back to previous step",
} }
template.values = get_recipient_and_placeholders_from_session( template.values = get_recipient_and_placeholders_from_session(

View File

@@ -1451,7 +1451,7 @@ def test_send_one_off_offers_link_to_upload(
assert back_link.text.strip() in { assert back_link.text.strip() in {
"Back to all templates", "Back to all templates",
"Back to confirm your template" "Back to confirm your template",
} }
assert link.text.strip() == "Upload a list of phone numbers" assert link.text.strip() == "Upload a list of phone numbers"
@@ -2288,7 +2288,9 @@ def test_check_messages_back_link(
actual_href = page.find_all("a", {"class": "usa-back-link"})[0]["href"] actual_href = page.find_all("a", {"class": "usa-back-link"})[0]["href"]
expected_href = expected_url(service_id=SERVICE_ONE_ID, template_id=fake_uuid) expected_href = expected_url(service_id=SERVICE_ONE_ID, template_id=fake_uuid)
assert actual_href != "#", "Back link href fell back to '#' — missing correct back_link in view" assert (
actual_href != "#"
), "Back link href fell back to '#' — missing correct back_link in view"
assert actual_href == expected_href assert actual_href == expected_href

View File

@@ -24,6 +24,8 @@ def test_sets_metadata(client_request, mocker):
def test_removes_blank_lines(): def test_removes_blank_lines():
filedata = {"data": "variable,phone number\r\ntest,+15555555555\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"} filedata = {
"data": "variable,phone number\r\ntest,+15555555555\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
}
file_data = remove_blank_lines(filedata) file_data = remove_blank_lines(filedata)
assert file_data == {"data": "variable,phone number\r\ntest,+15555555555"} assert file_data == {"data": "variable,phone number\r\ntest,+15555555555"}