Duplicate tests for options with branding set

This is a step towards further refactoring of the page tests, which
don't need to check in this level of detail anymore.
This commit is contained in:
Ben Thorner
2022-03-03 13:10:04 +00:00
parent 5a39e310aa
commit 857b8b04b0

View File

@@ -1,3 +1,5 @@
from unittest.mock import PropertyMock
import pytest
from app.models.service import Service
@@ -83,3 +85,48 @@ def test_get_available_choices_with_central_org(
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()
)
mocker.patch(
'app.models.service.Service.email_branding_id',
new_callable=PropertyMock,
return_value='1234-abcd',
)
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'),
]
def test_get_available_choices_letter_branding_set(
mocker,
service_one,
mock_get_service_organisation,
mock_get_letter_branding_by_id,
):
service = Service(service_one)
mocker.patch(
'app.organisations_client.get_organisation',
return_value=organisation_json()
)
options = get_available_choices(service, branding_type='letter')
assert list(options) == [
('organisation', 'Test Organisation'),
]