mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:45:32 -04:00
Introduce new org types
This commit is contained in:
@@ -39,6 +39,11 @@ class Config(object):
|
|||||||
'central': 250000,
|
'central': 250000,
|
||||||
'local': 25000,
|
'local': 25000,
|
||||||
'nhs': 25000,
|
'nhs': 25000,
|
||||||
|
'nhs_central': 250000,
|
||||||
|
'nhs_local': 25000,
|
||||||
|
'emergency_service': 25000,
|
||||||
|
'school_or_college': 25000,
|
||||||
|
'other': 25000,
|
||||||
}
|
}
|
||||||
EMAIL_EXPIRY_SECONDS = 3600 # 1 hour
|
EMAIL_EXPIRY_SECONDS = 3600 # 1 hour
|
||||||
INVITATION_EXPIRY_SECONDS = 3600 * 24 * 2 # 2 days - also set on api
|
INVITATION_EXPIRY_SECONDS = 3600 * 24 * 2 # 2 days - also set on api
|
||||||
|
|||||||
@@ -248,7 +248,11 @@ def organisation_type(label='Who runs this service?'):
|
|||||||
choices=[
|
choices=[
|
||||||
('central', 'Central government'),
|
('central', 'Central government'),
|
||||||
('local', 'Local government'),
|
('local', 'Local government'),
|
||||||
('nhs', 'NHS'),
|
('nhs_central', 'NHS – central government agency or public body'),
|
||||||
|
('nhs_local', 'NHS Trust, GP surgery or Clinical Commissioning Group'),
|
||||||
|
('emergency_service', 'Emergency service'),
|
||||||
|
('school_or_college', 'School or college'),
|
||||||
|
('other', 'Other'),
|
||||||
],
|
],
|
||||||
validators=[DataRequired()],
|
validators=[DataRequired()],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -268,7 +268,9 @@ class Service(JSONModel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def shouldnt_use_govuk_as_sms_sender(self):
|
def shouldnt_use_govuk_as_sms_sender(self):
|
||||||
return self.organisation_type in {'local', 'nhs'}
|
return self.organisation_type in {
|
||||||
|
'local', 'nhs', 'nhs_local', 'nhs_central', 'emergency_service', 'school_or_college', 'other'
|
||||||
|
}
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def sms_senders(self):
|
def sms_senders(self):
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ class User(JSONModel, UserMixin):
|
|||||||
if self.default_organisation:
|
if self.default_organisation:
|
||||||
return self.default_organisation.organisation_type
|
return self.default_organisation.organisation_type
|
||||||
if self.has_nhs_email_address:
|
if self.has_nhs_email_address:
|
||||||
return 'nhs'
|
return 'nhs_local'
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -28,7 +28,11 @@
|
|||||||
{{ optional_text_field({
|
{{ optional_text_field({
|
||||||
'central': 'Central government',
|
'central': 'Central government',
|
||||||
'local': 'Local government',
|
'local': 'Local government',
|
||||||
'nhs': 'NHS',
|
'nhs_central': 'NHS – central government agency or public body',
|
||||||
|
'nhs_local': 'NHS Trust, GP surgery or Clinical Commissioning Group',
|
||||||
|
'emergency_service': 'Emergency service',
|
||||||
|
'school_or_college': 'School or college',
|
||||||
|
'other': 'Other',
|
||||||
}.get(current_org.organisation_type)) }}
|
}.get(current_org.organisation_type)) }}
|
||||||
{{ edit_field(
|
{{ edit_field(
|
||||||
'Change',
|
'Change',
|
||||||
|
|||||||
@@ -90,7 +90,11 @@ def test_page_to_create_new_organisation(
|
|||||||
('text', 'name', ''),
|
('text', 'name', ''),
|
||||||
('radio', 'organisation_type', 'central'),
|
('radio', 'organisation_type', 'central'),
|
||||||
('radio', 'organisation_type', 'local'),
|
('radio', 'organisation_type', 'local'),
|
||||||
('radio', 'organisation_type', 'nhs'),
|
('radio', 'organisation_type', 'nhs_central'),
|
||||||
|
('radio', 'organisation_type', 'nhs_local'),
|
||||||
|
('radio', 'organisation_type', 'emergency_service'),
|
||||||
|
('radio', 'organisation_type', 'school_or_college'),
|
||||||
|
('radio', 'organisation_type', 'other'),
|
||||||
('radio', 'crown_status', 'crown'),
|
('radio', 'crown_status', 'crown'),
|
||||||
('radio', 'crown_status', 'non-crown'),
|
('radio', 'crown_status', 'non-crown'),
|
||||||
('hidden', 'csrf_token', ANY),
|
('hidden', 'csrf_token', ANY),
|
||||||
@@ -275,7 +279,11 @@ def test_organisation_settings_for_platform_admin(
|
|||||||
(
|
(
|
||||||
('central', 'Central government'),
|
('central', 'Central government'),
|
||||||
('local', 'Local government'),
|
('local', 'Local government'),
|
||||||
('nhs', 'NHS'),
|
('nhs_central', 'NHS – central government agency or public body'),
|
||||||
|
('nhs_local', 'NHS Trust, GP surgery or Clinical Commissioning Group'),
|
||||||
|
('emergency_service', 'Emergency service'),
|
||||||
|
('school_or_college', 'School or college'),
|
||||||
|
('other', 'Other'),
|
||||||
),
|
),
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
@@ -358,8 +366,8 @@ def test_view_organisation_settings(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
'.edit_organisation_type',
|
'.edit_organisation_type',
|
||||||
{'organisation_type': 'nhs'},
|
{'organisation_type': 'nhs_local'},
|
||||||
{'organisation_type': 'nhs'},
|
{'organisation_type': 'nhs_local'},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'.edit_organisation_crown_status',
|
'.edit_organisation_crown_status',
|
||||||
|
|||||||
@@ -41,14 +41,22 @@ def test_get_should_render_add_service_template(
|
|||||||
] == [
|
] == [
|
||||||
'Central government',
|
'Central government',
|
||||||
'Local government',
|
'Local government',
|
||||||
'NHS',
|
'NHS – central government agency or public body',
|
||||||
|
'NHS Trust, GP surgery or Clinical Commissioning Group',
|
||||||
|
'Emergency service',
|
||||||
|
'School or college',
|
||||||
|
'Other',
|
||||||
]
|
]
|
||||||
assert [
|
assert [
|
||||||
radio['value'] for radio in page.select('.multiple-choice input')
|
radio['value'] for radio in page.select('.multiple-choice input')
|
||||||
] == [
|
] == [
|
||||||
'central',
|
'central',
|
||||||
'local',
|
'local',
|
||||||
'nhs',
|
'nhs_central',
|
||||||
|
'nhs_local',
|
||||||
|
'emergency_service',
|
||||||
|
'school_or_college',
|
||||||
|
'other',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -71,8 +79,12 @@ def test_get_should_not_render_radios_if_org_type_known(
|
|||||||
@pytest.mark.parametrize('inherited, posted, persisted, sms_limit', (
|
@pytest.mark.parametrize('inherited, posted, persisted, sms_limit', (
|
||||||
(None, 'central', 'central', 250000),
|
(None, 'central', 'central', 250000),
|
||||||
('central', None, 'central', 250000),
|
('central', None, 'central', 250000),
|
||||||
('nhs', None, 'nhs', 25000),
|
('nhs_central', None, 'nhs_central', 250000),
|
||||||
|
('nhs_local', None, 'nhs_local', 25000),
|
||||||
('local', None, 'local', 25000),
|
('local', None, 'local', 25000),
|
||||||
|
('emergency_service', None, 'emergency_service', 25000),
|
||||||
|
('school_or_college', None, 'school_or_college', 25000),
|
||||||
|
('other', None, 'other', 25000),
|
||||||
('central', 'local', 'central', 250000),
|
('central', 'local', 'central', 250000),
|
||||||
))
|
))
|
||||||
def test_should_add_service_and_redirect_to_tour_when_no_services(
|
def test_should_add_service_and_redirect_to_tour_when_no_services(
|
||||||
@@ -189,13 +201,17 @@ def test_add_service_guesses_org_type_for_unknown_nhs_orgs(
|
|||||||
'main.add_service',
|
'main.add_service',
|
||||||
_data={'name': 'example'},
|
_data={'name': 'example'},
|
||||||
)
|
)
|
||||||
assert mock_create_service.call_args[1]['organisation_type'] == 'nhs'
|
assert mock_create_service.call_args[1]['organisation_type'] == 'nhs_local'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('organisation_type, free_allowance', [
|
@pytest.mark.parametrize('organisation_type, free_allowance', [
|
||||||
('central', 250 * 1000),
|
('central', 250 * 1000),
|
||||||
('local', 25 * 1000),
|
('local', 25 * 1000),
|
||||||
('nhs', 25 * 1000),
|
('nhs_central', 250 * 1000),
|
||||||
|
('nhs_local', 25 * 1000),
|
||||||
|
('school_or_college', 25 * 1000),
|
||||||
|
('emergency_service', 25 * 1000),
|
||||||
|
('other', 25 * 1000),
|
||||||
])
|
])
|
||||||
def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
|
def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
|
||||||
app_,
|
app_,
|
||||||
|
|||||||
Reference in New Issue
Block a user