From cbc69191be4920ac2bc09307e7757a12c573cb47 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 18 Dec 2023 12:58:36 -0800 Subject: [PATCH] fix s3upload mock --- tests/app/main/views/test_send.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index e4693f2c0..17691c22d 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -2118,6 +2118,7 @@ def test_route_permissions_send_check_notifications( response_code, method, mock_create_job, + mock_s3_upload, ): with client_request.session_transaction() as session: session["recipient"] = "2028675301" @@ -2129,7 +2130,6 @@ def test_route_permissions_send_check_notifications( return_value=FAKE_ONE_OFF_NOTIFICATION, ) - mocker.patch("app.s3_client.s3_csv_client.s3upload") validate_route_permission_with_client( mocker, client_request, @@ -2651,6 +2651,7 @@ def test_send_notification_submits_data( expected_personalisation, mocker, mock_create_job, + mock_s3_upload, ): with client_request.session_transaction() as session: session["recipient"] = recipient @@ -2661,8 +2662,6 @@ def test_send_notification_submits_data( return_value=FAKE_ONE_OFF_NOTIFICATION, ) - mocker.patch("app.s3_client.s3_csv_client.s3upload") - mocker.patch("app.main.views.send.check_messages", return_value="") client_request.post( @@ -2680,6 +2679,7 @@ def test_send_notification_clears_session( mock_get_service_template, mocker, mock_create_job, + mock_s3_upload, ): with client_request.session_transaction() as session: session["recipient"] = "2028675301" @@ -2691,8 +2691,6 @@ def test_send_notification_clears_session( return_value=FAKE_ONE_OFF_NOTIFICATION, ) - mocker.patch("app.s3_client.s3_csv_client.s3upload") - client_request.post( "main.send_notification", service_id=service_one["id"], template_id=fake_uuid ) @@ -2743,6 +2741,7 @@ def test_send_notification_redirects_to_view_page( extra_redirect_args, mocker, mock_create_job, + mock_s3_upload, ): with client_request.session_transaction() as session: session["recipient"] = "2028675301" @@ -2755,8 +2754,6 @@ def test_send_notification_redirects_to_view_page( return_value=FAKE_ONE_OFF_NOTIFICATION, ) - mocker.patch("app.s3_client.s3_csv_client.s3upload") - client_request.post( "main.send_notification", service_id=SERVICE_ONE_ID, @@ -2804,6 +2801,7 @@ def test_send_notification_shows_error_if_400( exception_msg, expected_h1, expected_err_details, + mock_s3_upload, ): class MockHTTPError(HTTPError): message = exception_msg @@ -2817,8 +2815,6 @@ def test_send_notification_shows_error_if_400( return_value=FAKE_ONE_OFF_NOTIFICATION, ) - mocker.patch("app.s3_client.s3_csv_client.s3upload") - mocker.patch( "app.notification_api_client.send_notification", side_effect=MockHTTPError(), @@ -2851,6 +2847,7 @@ def test_send_notification_shows_email_error_in_trial_mode( mocker, mock_get_service_email_template, mock_create_job, + mock_s3_upload, ): class MockHTTPError(HTTPError): message = TRIAL_MODE_MSG @@ -2862,8 +2859,6 @@ def test_send_notification_shows_email_error_in_trial_mode( return_value=FAKE_ONE_OFF_NOTIFICATION, ) - mocker.patch("app.s3_client.s3_csv_client.s3upload") - mocker.patch( "app.notification_api_client.send_notification", side_effect=MockHTTPError(),