mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
Add missing test cases for default branding
This commit is contained in:
@@ -9,6 +9,7 @@ from app.utils.branding import (
|
|||||||
get_letter_choices,
|
get_letter_choices,
|
||||||
)
|
)
|
||||||
from tests import organisation_json
|
from tests import organisation_json
|
||||||
|
from tests.conftest import create_email_branding
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('function', [get_email_choices, get_letter_choices])
|
@pytest.mark.parametrize('function', [get_email_choices, get_letter_choices])
|
||||||
@@ -78,6 +79,46 @@ def test_get_email_choices_service_assigned_to_org(
|
|||||||
assert list(options) == expected_options
|
assert list(options) == expected_options
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('org_type, branding_id, expected_options', [
|
||||||
|
('central', 'some-branding-id', [
|
||||||
|
# don't show GOV.UK options as org default supersedes it
|
||||||
|
('organisation', 'Test Organisation'),
|
||||||
|
]),
|
||||||
|
('central', 'org-branding-id', [
|
||||||
|
# also don't show org option if it's the current branding
|
||||||
|
]),
|
||||||
|
('local', 'org-branding-id', [
|
||||||
|
# don't show org option if it's the current branding
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
def test_get_email_choices_org_has_default_branding(
|
||||||
|
mocker,
|
||||||
|
service_one,
|
||||||
|
org_type,
|
||||||
|
branding_id,
|
||||||
|
expected_options,
|
||||||
|
mock_get_service_organisation,
|
||||||
|
mock_get_email_branding
|
||||||
|
):
|
||||||
|
service = Service(service_one)
|
||||||
|
|
||||||
|
mocker.patch(
|
||||||
|
'app.organisations_client.get_organisation',
|
||||||
|
return_value=organisation_json(
|
||||||
|
organisation_type=org_type,
|
||||||
|
email_branding_id='org-branding-id'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
mocker.patch(
|
||||||
|
'app.models.service.Service.email_branding_id',
|
||||||
|
new_callable=PropertyMock,
|
||||||
|
return_value=branding_id
|
||||||
|
)
|
||||||
|
|
||||||
|
options = get_email_choices(service)
|
||||||
|
assert list(options) == expected_options
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('org_type, branding_id, expected_options', [
|
@pytest.mark.parametrize('org_type, branding_id, expected_options', [
|
||||||
('central', None, [
|
('central', None, [
|
||||||
('organisation', 'Test Organisation')
|
('organisation', 'Test Organisation')
|
||||||
@@ -114,3 +155,39 @@ def test_get_letter_choices_service_assigned_to_org(
|
|||||||
|
|
||||||
options = get_letter_choices(service)
|
options = get_letter_choices(service)
|
||||||
assert list(options) == expected_options
|
assert list(options) == expected_options
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('branding_id, expected_options', [
|
||||||
|
('some-branding-id', [
|
||||||
|
# show org option if it's not the current branding
|
||||||
|
('organisation', 'Test Organisation'),
|
||||||
|
]),
|
||||||
|
('org-branding-id', [
|
||||||
|
# don't show org option if it's the current branding
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
def test_get_letter_choices_org_has_default_branding(
|
||||||
|
mocker,
|
||||||
|
service_one,
|
||||||
|
branding_id,
|
||||||
|
expected_options,
|
||||||
|
mock_get_service_organisation,
|
||||||
|
):
|
||||||
|
service = Service(service_one)
|
||||||
|
|
||||||
|
mocker.patch(
|
||||||
|
'app.organisations_client.get_organisation',
|
||||||
|
return_value=organisation_json(
|
||||||
|
organisation_type='central',
|
||||||
|
letter_branding_id='org-branding-id'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
mocker.patch(
|
||||||
|
'app.models.service.Service.letter_branding_id',
|
||||||
|
new_callable=PropertyMock,
|
||||||
|
return_value=branding_id
|
||||||
|
)
|
||||||
|
|
||||||
|
options = get_letter_choices(service)
|
||||||
|
# don't show org option if it's the current branding
|
||||||
|
assert list(options) == expected_options
|
||||||
|
|||||||
Reference in New Issue
Block a user