From 9031d0cb977dd0ec0797a07eb34a24f9768d4261 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Mon, 11 Sep 2023 17:02:56 -0400 Subject: [PATCH] A few more tests taken care of. Signed-off-by: Carlo Costino --- tests/app/main/views/test_email_branding.py | 4 +- tests/app/main/views/test_email_preview.py | 2 +- tests/app/main/views/test_feedback.py | 59 ++++++++++++--------- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/tests/app/main/views/test_email_branding.py b/tests/app/main/views/test_email_branding.py index 672d41f35..fe86c108c 100644 --- a/tests/app/main/views/test_email_branding.py +++ b/tests/app/main/views/test_email_branding.py @@ -217,7 +217,7 @@ def test_create_new_email_branding_when_branding_saved( @pytest.mark.parametrize( - "endpoint, has_data", + ("endpoint", "has_data"), [ ("main.create_email_branding", False), ("main.update_email_branding", True), @@ -416,7 +416,7 @@ def test_logo_does_not_get_persisted_if_updating_email_branding_client_throws_an @pytest.mark.parametrize( - "colour_hex, expected_status_code", + ("colour_hex", "expected_status_code"), [ ("#FF00FF", 302), ("hello", 200), diff --git a/tests/app/main/views/test_email_preview.py b/tests/app/main/views/test_email_preview.py index 082394018..60604a9f3 100644 --- a/tests/app/main/views/test_email_preview.py +++ b/tests/app/main/views/test_email_preview.py @@ -4,7 +4,7 @@ import pytest @pytest.mark.parametrize( - "query_args, result", [({}, True), ({"govuk_banner": "false"}, "false")] + ("query_args", "result"), [({}, True), ({"govuk_banner": "false"}, "false")] ) def test_renders(client_request, mocker, query_args, result): mocker.patch( diff --git a/tests/app/main/views/test_feedback.py b/tests/app/main/views/test_feedback.py index 89f757bff..e3ab37e93 100644 --- a/tests/app/main/views/test_feedback.py +++ b/tests/app/main/views/test_feedback.py @@ -68,7 +68,7 @@ def test_get_support_index_page_when_signed_out( @freeze_time("2016-12-12 12:00:00.000000") @pytest.mark.parametrize( - "support_type, expected_h1", + ("support_type", "expected_h1"), [ (PROBLEM_TICKET_TYPE, "Report a problem"), (QUESTION_TICKET_TYPE, "Ask a question or give feedback"), @@ -130,7 +130,7 @@ def test_get_support_as_member_of_public( @freeze_time("2016-12-12 12:00:00.000000") @pytest.mark.parametrize( - "ticket_type, expected_status_code", + ("ticket_type", "expected_status_code"), [(PROBLEM_TICKET_TYPE, 200), (QUESTION_TICKET_TYPE, 200), ("gripe", 404)], ) def test_get_feedback_page(client_request, ticket_type, expected_status_code): @@ -144,7 +144,7 @@ def test_get_feedback_page(client_request, ticket_type, expected_status_code): @freeze_time("2016-12-12 12:00:00.000000") @pytest.mark.parametrize( - "ticket_type, zendesk_ticket_type", + ("ticket_type", "zendesk_ticket_type"), [ (PROBLEM_TICKET_TYPE, "incident"), (QUESTION_TICKET_TYPE, "question"), @@ -202,7 +202,7 @@ def test_passed_non_logged_in_user_details_through_flow( ], ) @pytest.mark.parametrize( - "ticket_type, zendesk_ticket_type", + ("ticket_type", "zendesk_ticket_type"), [ (PROBLEM_TICKET_TYPE, "incident"), (QUESTION_TICKET_TYPE, "question"), @@ -294,7 +294,7 @@ def test_email_address_required_for_problems_and_questions( @freeze_time("2016-12-12 12:00:00.000000") -@pytest.mark.parametrize("ticket_type", (PROBLEM_TICKET_TYPE, QUESTION_TICKET_TYPE)) +@pytest.mark.parametrize("ticket_type", [PROBLEM_TICKET_TYPE, QUESTION_TICKET_TYPE]) def test_email_address_must_be_valid_if_provided_to_support_form( client_request, mocker, @@ -317,7 +317,7 @@ def test_email_address_must_be_valid_if_provided_to_support_form( @pytest.mark.parametrize( - "ticket_type, severe, is_in_business_hours, is_out_of_hours_emergency", + ("ticket_type", "severe", "is_in_business_hours", "is_out_of_hours_emergency"), [ # business hours, never an emergency (PROBLEM_TICKET_TYPE, "yes", True, False), @@ -408,8 +408,12 @@ ids, params = zip( @pytest.mark.parametrize( ( - "ticket_type, is_in_business_hours, logged_in, has_live_services," - "expected_status, expected_redirect" + "ticket_type", + "is_in_business_hours", + "logged_in", + "has_live_services", + "expected_status", + "expected_redirect", ), params, ids=ids, @@ -446,11 +450,11 @@ def test_redirects_to_triage( @pytest.mark.parametrize( - "ticket_type, expected_h1", - ( + ("ticket_type", "expected_h1"), + [ (PROBLEM_TICKET_TYPE, "Report a problem"), (GENERAL_TICKET_TYPE, "Contact Notify.gov support"), - ), + ], ) def test_options_on_triage_page( client_request, @@ -492,7 +496,7 @@ def test_doesnt_lose_message_if_post_across_closing( @pytest.mark.parametrize( - "when, is_in_business_hours", + ("when", "is_in_business_hours"), [ ("2016-06-06 09:29:59+0100", False), # opening time, summer and winter ("2016-12-12 09:29:59+0000", False), @@ -513,13 +517,13 @@ def test_in_business_hours(when, is_in_business_hours): @pytest.mark.parametrize( "ticket_type", - ( + [ GENERAL_TICKET_TYPE, PROBLEM_TICKET_TYPE, - ), + ], ) @pytest.mark.parametrize( - "choice, expected_redirect_param", + ("choice", "expected_redirect_param"), [ ("yes", "yes"), ("no", "no"), @@ -545,7 +549,7 @@ def test_triage_redirects_to_correct_url( @pytest.mark.parametrize( - "extra_args, expected_back_link", + ("extra_args", "expected_back_link"), [ ( {"severe": "yes"}, @@ -575,9 +579,12 @@ def test_back_link_from_form( @pytest.mark.parametrize( ( - "is_in_business_hours, severe," - "expected_status_code, expected_redirect," - "expected_status_code_when_logged_in, expected_redirect_when_logged_in" + "is_in_business_hours", + "severe", + "expected_status_code", + "expected_redirect", + "expected_status_code_when_logged_in", + "expected_redirect_when_logged_in", ), [ (True, "yes", 200, no_redirect(), 200, no_redirect()), @@ -658,9 +665,11 @@ def test_should_be_shown_the_bat_email( @pytest.mark.parametrize( ( - "severe," - "expected_status_code, expected_redirect," - "expected_status_code_when_logged_in, expected_redirect_when_logged_in" + "severe", + "expected_status_code", + "expected_redirect", + "expected_status_code_when_logged_in", + "expected_redirect_when_logged_in", ), [ # User hasn’t answered the triage question @@ -743,8 +752,8 @@ def test_bat_email_page( @pytest.mark.parametrize( - "out_of_hours_emergency, email_address_provided, out_of_hours, message", - ( + ("out_of_hours_emergency", "email_address_provided", "out_of_hours", "message"), + [ # Out of hours emergencies trump everything else ( True, @@ -780,7 +789,7 @@ def test_bat_email_page( "We’ll aim to read your message in the next 30 minutes and we’ll reply within one working day.", ), (False, True, True, "We’ll reply within one working day."), - ), + ], ) def test_thanks( client_request,