mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 21:49:37 -04:00
update tests based on updated orgs
This commit is contained in:
@@ -5,11 +5,9 @@ from functools import partial
|
||||
from flask import flash, redirect, render_template, request, send_file, url_for
|
||||
from flask_login import current_user
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from werkzeug.exceptions import abort
|
||||
|
||||
from app import (
|
||||
current_organisation,
|
||||
current_service,
|
||||
email_branding_client,
|
||||
letter_branding_client,
|
||||
org_invite_api_client,
|
||||
|
||||
@@ -26,7 +26,7 @@ class Organisation(JSONModel, SortByNameMixin):
|
||||
# TYPE_NHS_GP = 'nhs_gp'
|
||||
# TYPE_EMERGENCY_SERVICE = 'emergency_service'
|
||||
# TYPE_SCHOOL_OR_COLLEGE = 'school_or_college'
|
||||
# TYPE_OTHER = 'other'
|
||||
TYPE_OTHER = 'other'
|
||||
|
||||
# NHS_TYPES = (
|
||||
# TYPE_NHS_CENTRAL,
|
||||
@@ -36,7 +36,7 @@ class Organisation(JSONModel, SortByNameMixin):
|
||||
|
||||
TYPE_LABELS = OrderedDict([
|
||||
(TYPE_FEDERAL, 'Federal government'),
|
||||
(TYPE_STATE, 'State government')
|
||||
(TYPE_STATE, 'State government'),
|
||||
|
||||
# (TYPE_CENTRAL, 'Central government'),
|
||||
# (TYPE_LOCAL, 'Local government'),
|
||||
@@ -45,7 +45,7 @@ class Organisation(JSONModel, SortByNameMixin):
|
||||
# (TYPE_NHS_GP, 'GP practice'),
|
||||
# (TYPE_EMERGENCY_SERVICE, 'Emergency service'),
|
||||
# (TYPE_SCHOOL_OR_COLLEGE, 'School or college'),
|
||||
# (TYPE_OTHER, 'Other'),
|
||||
(TYPE_OTHER, 'Other'),
|
||||
])
|
||||
|
||||
ALLOWED_PROPERTIES = {
|
||||
|
||||
@@ -223,8 +223,8 @@ class MainNavigation(Navigation):
|
||||
'usage',
|
||||
},
|
||||
'settings': {
|
||||
'add_organisation_from_gp_service',
|
||||
'add_organisation_from_nhs_local_service',
|
||||
# 'add_organisation_from_gp_service',
|
||||
# 'add_organisation_from_nhs_local_service',
|
||||
'email_branding_govuk',
|
||||
'email_branding_govuk_and_org',
|
||||
'email_branding_nhs',
|
||||
|
||||
@@ -7,49 +7,33 @@ def get_email_choices(service):
|
||||
organisation_branding_id = service.organisation.email_branding_id if service.organisation else None
|
||||
|
||||
if (
|
||||
service.organisation_type == Organisation.TYPE_CENTRAL
|
||||
service.organisation_type == Organisation.TYPE_FEDERAL
|
||||
and service.email_branding_id is not None # GOV.UK is not current branding
|
||||
and organisation_branding_id is None # no default to supersede it (GOV.UK)
|
||||
):
|
||||
yield ('govuk', 'GOV.UK')
|
||||
|
||||
if (
|
||||
service.organisation_type == Organisation.TYPE_CENTRAL
|
||||
service.organisation_type == Organisation.TYPE_FEDERAL
|
||||
and service.organisation
|
||||
and organisation_branding_id is None # don't offer both if org has default
|
||||
and service.email_branding_name.lower() != f'GOV.UK and {service.organisation.name}'.lower()
|
||||
):
|
||||
yield ('govuk_and_org', f'GOV.UK and {service.organisation.name}')
|
||||
|
||||
if (
|
||||
service.organisation_type in Organisation.NHS_TYPES
|
||||
and service.email_branding_id != NHS_EMAIL_BRANDING_ID
|
||||
):
|
||||
yield ('nhs', 'NHS')
|
||||
|
||||
if (
|
||||
service.organisation
|
||||
and service.organisation_type not in Organisation.NHS_TYPES
|
||||
and (
|
||||
service.email_branding_id is None # GOV.UK is current branding
|
||||
or service.email_branding_id != organisation_branding_id
|
||||
)
|
||||
):
|
||||
yield ('organisation', service.organisation.name)
|
||||
|
||||
|
||||
def get_letter_choices(service):
|
||||
organisation_branding_id = service.organisation.letter_branding_id if service.organisation else None
|
||||
|
||||
if (
|
||||
service.organisation_type in Organisation.NHS_TYPES
|
||||
and service.letter_branding_name != 'NHS'
|
||||
):
|
||||
yield ('nhs', 'NHS')
|
||||
# if (
|
||||
# service.organisation_type in Organisation.NHS_TYPES
|
||||
# and service.letter_branding_name != 'NHS'
|
||||
# ):
|
||||
# yield ('nhs', 'NHS')
|
||||
|
||||
if (
|
||||
service.organisation
|
||||
and service.organisation_type not in Organisation.NHS_TYPES
|
||||
# and service.organisation_type not in Organisation.NHS_TYPES
|
||||
and (
|
||||
service.letter_branding_id is None # GOV.UK is current branding
|
||||
or service.letter_branding_id != organisation_branding_id
|
||||
|
||||
Reference in New Issue
Block a user