Skip to content

Commit

Permalink
fix failing tests; remove letter test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleith committed Dec 6, 2024
1 parent 1204787 commit 1ceea8c
Showing 1 changed file with 4 additions and 54 deletions.
58 changes: 4 additions & 54 deletions tests/app/main/views/test_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ def test_link_to_upload_not_offered_when_entering_personalisation(

# We’re entering personalisation
assert page.select_one("input[type=text]")["name"] == "placeholder_value"
assert page.select_one("h1 label[for=placeholder_value]").text.strip() == "What is the custom content in ((name)) ?"
assert page.select_one("h1 label[for=placeholder_value]").text.strip() == "What is the custom content in ((name)) ?"
# …but first link on the page is ‘Back’, so not preceeded by ‘Upload’
assert page.select_one("main a").text == "Back"
assert "Upload" not in page.select_one("main").text
Expand Down Expand Up @@ -2545,7 +2545,7 @@ def test_check_messages_shows_too_many_sms_messages_errors(
mock_get_jobs,
mock_s3_download,
mock_s3_set_metadata,
mock_notification_counts_client,
mock_get_limit_stats,
fake_uuid,
num_requested,
expected_msg,
Expand All @@ -2563,10 +2563,6 @@ def test_check_messages_shows_too_many_sms_messages_errors(
},
)

mock_notification_counts_client.get_all_notification_counts_for_year.return_value = {
"sms": 0,
"email": 0,
}
with client_request.session_transaction() as session:
session["file_uploads"] = {
fake_uuid: {
Expand Down Expand Up @@ -2632,7 +2628,7 @@ def test_check_messages_shows_too_many_email_messages_errors(
mock_get_template_statistics,
mock_get_job_doesnt_exist,
mock_get_jobs,
mock_notification_counts_client,
mock_get_limit_stats,
fake_uuid,
num_requested,
expected_msg,
Expand All @@ -2649,10 +2645,7 @@ def test_check_messages_shows_too_many_email_messages_errors(
"email": {"requested": num_requested, "delivered": 0, "failed": 0},
},
)
mock_notification_counts_client.get_all_notification_counts_for_year.return_value = {
"sms": 0,
"email": 0,
}

with client_request.session_transaction() as session:
session["file_uploads"] = {
fake_uuid: {
Expand Down Expand Up @@ -2758,49 +2751,6 @@ def test_warns_if_file_sent_already(
mock_get_jobs.assert_called_once_with(SERVICE_ONE_ID, limit_days=0)


def test_check_messages_column_error_doesnt_show_optional_columns(
mocker,
client_request,
mock_get_service_letter_template,
mock_has_permissions,
fake_uuid,
mock_get_users_by_service,
mock_get_service_statistics,
mock_get_template_statistics,
mock_get_job_doesnt_exist,
mock_get_jobs,
):
mocker.patch(
"app.main.views.send.s3download",
return_value="\n".join(["address_line_1,address_line_2,foo"] + ["First Lastname,1 Example Road,SW1 1AA"]),
)

mocker.patch(
"app.main.views.send.get_page_count_for_letter",
return_value=5,
)

with client_request.session_transaction() as session:
session["file_uploads"] = {
fake_uuid: {
"template_id": "",
"original_file_name": "",
}
}

page = client_request.get(
"main.check_messages",
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
upload_id=fake_uuid,
_test_page_title=False,
)

assert normalize_spaces(page.select_one(".banner-dangerous").text) == (
"Your spreadsheet is missing a column called ‘postcode’. " "Add the missing column."
)


def test_check_messages_adds_sender_id_in_session_to_metadata(
client_request,
mocker,
Expand Down

0 comments on commit 1ceea8c

Please sign in to comment.