fix remaining tests

This commit is contained in:
Kenneth Kehl
2023-10-30 08:42:11 -07:00
parent 8c9acad081
commit b487a915f6
6 changed files with 77 additions and 68 deletions

View File

@@ -2319,25 +2319,31 @@ def test_warns_if_file_sent_already_errors(
"app.main.views.send.get_csv_metadata",
return_value={"original_file_name": uploaded_file_name},
)
# Should be botocore.errorfactory.NoSuchKey but for some reason can't use that
with pytest.raises( # noqa: PT011,PT012 # Requires more research on how to refactor.
expected_exception=Exception
with pytest.raises(
expected_exception=Exception, match="Unable to locate credentials"
):
page = client_request.get(
"main.check_messages",
service_id=SERVICE_ONE_ID,
template_id="5d729fbd-239c-44ab-b498-75a985f3198f",
upload_id=fake_uuid,
original_file_name=uploaded_file_name,
_test_page_title=False,
stmt_for_test_warns_if_file_sent_already_errors(
client_request, uploaded_file_name, fake_uuid, mock_get_jobs
)
assert normalize_spaces(page.select_one(".banner-dangerous").text) == (
"These messages have already been sent today "
"If you need to resend them, rename the file and upload it again."
)
mock_get_jobs.assert_called_once_with(SERVICE_ONE_ID, limit_days=0)
def stmt_for_test_warns_if_file_sent_already_errors(
client_request, uploaded_file_name, fake_uuid, mock_get_jobs
):
page = client_request.get(
"main.check_messages",
service_id=SERVICE_ONE_ID,
template_id="5d729fbd-239c-44ab-b498-75a985f3198f",
upload_id=fake_uuid,
original_file_name=uploaded_file_name,
_test_page_title=False,
)
assert normalize_spaces(page.select_one(".banner-dangerous").text) == (
"These messages have already been sent today "
"If you need to resend them, rename the file and upload it again."
)
mock_get_jobs.assert_called_once_with(SERVICE_ONE_ID, limit_days=0)
def test_check_messages_column_error_doesnt_show_optional_columns(