Merge branch 'main' into stvnrlly-remove-broadcasts

This commit is contained in:
stvnrlly
2022-10-26 01:27:44 +00:00
41 changed files with 378 additions and 546 deletions

View File

@@ -3,20 +3,16 @@ from unittest.mock import PropertyMock
import pytest
from app.models.service import Service
from app.utils.branding import (
NHS_EMAIL_BRANDING_ID,
get_email_choices,
get_letter_choices,
)
from app.utils.branding import get_email_choices, get_letter_choices
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('org_type, expected_options', [
('central', []),
('local', []),
('nhs_central', [('nhs', 'NHS')]),
('federal', []),
('state', []),
# ('nhs_central', [('nhs', 'NHS')]),
])
def test_get_choices_service_not_assigned_to_org(
service_one,
@@ -32,28 +28,29 @@ def test_get_choices_service_not_assigned_to_org(
@pytest.mark.parametrize('org_type, branding_id, expected_options', [
('central', None, [
('federal', None, [
('govuk_and_org', 'GOV.UK and Test Organisation'),
('organisation', 'Test Organisation'),
]),
('central', 'some-branding-id', [
('federal', 'some-branding-id', [
('govuk', 'GOV.UK'), # central orgs can switch back to gsa.gov
('govuk_and_org', 'GOV.UK and Test Organisation'),
('organisation', 'Test Organisation'),
]),
('local', None, [
('state', None, [
('organisation', 'Test Organisation')
]),
('local', 'some-branding-id', [
('state', 'some-branding-id', [
('organisation', 'Test Organisation')
]),
('nhs_central', None, [
('nhs', 'NHS')
]),
('nhs_central', NHS_EMAIL_BRANDING_ID, [
# don't show NHS if it's the current branding
]),
# ('nhs_central', None, [
# ('nhs', 'NHS')
# ]),
# ('nhs_central', NHS_EMAIL_BRANDING_ID, [
# # don't show NHS if it's the current branding
# ]),
])
@pytest.mark.skip(reason='Update for TTS')
def test_get_email_choices_service_assigned_to_org(
mocker,
service_one,
@@ -80,17 +77,18 @@ def test_get_email_choices_service_assigned_to_org(
@pytest.mark.parametrize('org_type, branding_id, expected_options', [
('central', 'some-branding-id', [
('federal', 'some-branding-id', [
# don't show gsa.gov options as org default supersedes it
('organisation', 'Test Organisation'),
]),
('central', 'org-branding-id', [
('federal', 'org-branding-id', [
# also don't show org option if it's the current branding
]),
('local', 'org-branding-id', [
('state', 'org-branding-id', [
# don't show org option if it's the current branding
]),
])
@pytest.mark.skip(reason='Update for TTS')
def test_get_email_choices_org_has_default_branding(
mocker,
service_one,
@@ -160,18 +158,18 @@ def test_get_email_choices_branding_name_in_use(
@pytest.mark.parametrize('org_type, branding_id, expected_options', [
('central', None, [
('federal', None, [
('organisation', 'Test Organisation')
]),
('local', None, [
('state', None, [
('organisation', 'Test Organisation')
]),
('local', 'some-random-branding', [
('state', 'some-random-branding', [
('organisation', 'Test Organisation')
]),
('nhs_central', None, [
('nhs', 'NHS')
]),
# ('nhs_central', None, [
# ('nhs', 'NHS')
# ]),
])
def test_get_letter_choices_service_assigned_to_org(
mocker,
@@ -218,7 +216,7 @@ def test_get_letter_choices_org_has_default_branding(
mocker.patch(
'app.organisations_client.get_organisation',
return_value=organisation_json(
organisation_type='central',
organisation_type='federal',
letter_branding_id='org-branding-id'
)
)
@@ -241,6 +239,7 @@ def test_get_letter_choices_org_has_default_branding(
# don't show NHS option if it's the current branding
])
])
@pytest.mark.skip(reason='Update for TTS')
def test_get_letter_choices_branding_name_in_use(
mocker,
service_one,