mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-12 09:58:50 -04:00
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:
@@ -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 'There’s 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
|
||||
) == (
|
||||
'There’s 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,', [
|
||||
|
||||
Reference in New Issue
Block a user