From 71368301f758c9335f950c2a27ce0e31fddf3a88 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 7 Dec 2017 14:32:05 +0000 Subject: [PATCH] Make test use new fixture The `client_request` fixture means the tests take fewer lines of code and also checks some extra things (eg page titles matching

s). Changing it in this commit, independently of functional changes to this test. --- tests/app/main/views/test_send.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index f3618f384..c148d03cb 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -441,7 +441,7 @@ def test_upload_csv_invalid_extension( def test_upload_valid_csv_shows_file_contents( - logged_in_client, + client_request, mocker, mock_get_service_template_with_placeholders, mock_s3_upload, @@ -455,14 +455,13 @@ def test_upload_valid_csv_shows_file_contents( 07700900986, Jo, foo, foo, foo """) - response = logged_in_client.post( - url_for('main.send_messages', service_id=SERVICE_ONE_ID, template_id=fake_uuid), - data={'file': (BytesIO(''.encode('utf-8')), 'valid.csv')}, - follow_redirects=True, + page = client_request.post( + 'main.send_messages', service_id=SERVICE_ONE_ID, template_id=fake_uuid, + _data={'file': (BytesIO(''.encode('utf-8')), 'valid.csv')}, + _follow_redirects=True, + _expected_status=200, ) - assert response.status_code == 200 - page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') assert page.h1.text.strip() == 'Preview of Two week reminder' for index, cell in enumerate([ ' 2 ',