From acd69b8d7de00afba152ab69954fc240879dec87 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Tue, 15 Mar 2022 12:10:13 +0000 Subject: [PATCH] Combine tests for central org email branding Central orgs have more options than others, including the option to revert back to GOV.UK once branding is set. Combining the tests together should make that a bit clearer. --- tests/app/utils/test_branding.py | 38 +++++++++----------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/tests/app/utils/test_branding.py b/tests/app/utils/test_branding.py index b42a9da76..a31779e74 100644 --- a/tests/app/utils/test_branding.py +++ b/tests/app/utils/test_branding.py @@ -58,57 +58,39 @@ def test_get_available_choices_service_assigned_to_org( assert list(options) == expected_options -@pytest.mark.parametrize('branding_type, expected_options', [ - ('email', [ +@pytest.mark.parametrize('service_branding, expected_options', [ + (None, [ ('govuk_and_org', 'GOV.UK and Test Organisation'), ('organisation', 'Test Organisation'), ]), - ('letter', [ + ('1234-abcd', [ + ('govuk', 'GOV.UK'), + ('govuk_and_org', 'GOV.UK and Test Organisation'), ('organisation', 'Test Organisation'), ]) ]) -def test_get_available_choices_with_central_org( +def test_get_available_choices_email_branding_central_org( mocker, service_one, - branding_type, + service_branding, expected_options, mock_get_service_organisation, -): - service = Service(service_one) - - mocker.patch( - 'app.organisations_client.get_organisation', - return_value=organisation_json(organisation_type='central'), - ) - - options = get_available_choices(service, branding_type=branding_type) - assert list(options) == expected_options - - -def test_get_available_choices_email_branding_set( - mocker, - service_one, - mock_get_service_organisation, mock_get_email_branding, ): service = Service(service_one) mocker.patch( 'app.organisations_client.get_organisation', - return_value=organisation_json() + return_value=organisation_json(organisation_type='central'), ) mocker.patch( 'app.models.service.Service.email_branding_id', new_callable=PropertyMock, - return_value='1234-abcd', + return_value=service_branding, ) options = get_available_choices(service, branding_type='email') - assert list(options) == [ - ('govuk', 'GOV.UK'), - ('govuk_and_org', 'GOV.UK and Test Organisation'), - ('organisation', 'Test Organisation'), - ] + assert list(options) == expected_options def test_get_available_choices_letter_branding_set(