mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Migrate two branding tests to utils module
This is much simpler than trying to test the function via the page, although there are still two scenarios to test there: - The page with radio buttons (using NHS as an example). - The page with a text form (using "other" as an example). In future work we could split this test in two to make it clearer what it's trying to test. For now, this keeps the diff simple.
This commit is contained in:
@@ -4753,27 +4753,10 @@ def test_update_service_organisation_does_not_update_if_same_value(
|
||||
|
||||
|
||||
@pytest.mark.parametrize('organisation_type, expected_options', (
|
||||
('central', [
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('local', [
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('nhs_central', [
|
||||
('nhs', 'NHS'),
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('nhs_local', [
|
||||
('nhs', 'NHS'),
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('nhs_gp', [
|
||||
('nhs', 'NHS'),
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('emergency_service', [
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('other', [
|
||||
('something_else', 'Something else'),
|
||||
])
|
||||
@@ -4818,21 +4801,10 @@ def test_email_branding_request_page_when_no_branding_is_set(
|
||||
|
||||
|
||||
@pytest.mark.parametrize('organisation_type, expected_options', (
|
||||
('central', None),
|
||||
('local', None),
|
||||
('nhs_central', [
|
||||
('nhs', 'NHS'),
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('nhs_local', [
|
||||
('nhs', 'NHS'),
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('nhs_gp', [
|
||||
('nhs', 'NHS'),
|
||||
('something_else', 'Something else'),
|
||||
]),
|
||||
('emergency_service', None),
|
||||
('other', None),
|
||||
))
|
||||
def test_letter_branding_request_page_when_no_branding_is_set(
|
||||
|
||||
28
tests/app/utils/test_branding.py
Normal file
28
tests/app/utils/test_branding.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import pytest
|
||||
|
||||
from app.models.service import Service
|
||||
from app.utils.branding import get_available_choices
|
||||
|
||||
|
||||
@pytest.mark.parametrize('branding_type', ['email', 'letter'])
|
||||
@pytest.mark.parametrize('org_type, existing_branding, expected_options', [
|
||||
('central', None, []),
|
||||
('local', None, []),
|
||||
('nhs_central', None, [('nhs', 'NHS')]),
|
||||
('nhs_local', None, [('nhs', 'NHS')]),
|
||||
('nhs_gp', None, [('nhs', 'NHS')]),
|
||||
('emergency_service', None, []),
|
||||
('other', None, []),
|
||||
])
|
||||
def test_get_available_choices_no_org(
|
||||
service_one,
|
||||
branding_type,
|
||||
org_type,
|
||||
existing_branding,
|
||||
expected_options,
|
||||
):
|
||||
service_one['organisation_type'] = org_type
|
||||
service = Service(service_one)
|
||||
|
||||
options = get_available_choices(service, branding_type=branding_type)
|
||||
assert list(options) == expected_options
|
||||
Reference in New Issue
Block a user