Make test more specific

Tests that just assert some content `in` the whole page are tricky to
debug, and make it harder to be sure that said content is showing up in
the right place, with the right markup and styling.
This commit is contained in:
Chris Hill-Scott
2020-04-11 11:06:58 +01:00
parent 202d4cdb5a
commit 8ce1497fc0

View File

@@ -475,9 +475,19 @@ def test_upload_csv_file_with_empty_message_shows_check_page_with_errors(
assert 'file_uploads' not in session
assert response.status_code == 200
content = response.get_data(as_text=True)
assert 'Theres a problem with invalid.csv' in content
assert 'check you have content for the empty message in 1 row' in content
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert normalize_spaces(
page.select_one('.banner-dangerous').text
) == (
'Theres a problem with invalid.csv '
'You need to check you have content for the empty message in 1 row. '
'Skip to file contents'
)
assert [
normalize_spaces(row.text) for row in page.select('tbody tr')
] == [
'3 +447700900986 no',
]
@pytest.mark.parametrize('file_contents, expected_error,', [