Remove 2020/21 free allowance data

🚨 Do not merge until after 1 April 2020 🚨

Once this date has past we no longer need to give any services the
previous allowances, so we can remove them from the codebase to avoid
confusion.

It’s possible we change the allowance structure again, but it might
change in a way that this config-based logic doesn’t account for (what
if we did a per-organisation allowance for example). Having both years’
allowances in the config was a quick fix, not a foundation to build on.
This commit is contained in:
Chris Hill-Scott
2021-03-10 14:51:40 +00:00
parent 19488aad97
commit ef50649572
3 changed files with 28 additions and 73 deletions

View File

@@ -33,38 +33,14 @@ class Config(object):
AWS_REGION = 'eu-west-1'
DEFAULT_SERVICE_LIMIT = 50
DEFAULT_FREE_SMS_FRAGMENT_LIMITS = {
'central': {
2020: 250_000,
2021: 150_000,
},
'local': {
2020: 25_000,
2021: 25_000,
},
'nhs_central': {
2020: 250_000,
2021: 150_000,
},
'nhs_local': {
2020: 25_000,
2021: 25_000,
},
'nhs_gp': {
2020: 25_000,
2021: 10_000,
},
'emergency_service': {
2020: 25_000,
2021: 25_000,
},
'school_or_college': {
2020: 25_000,
2021: 10_000,
},
'other': {
2020: 25_000,
2021: 10_000,
},
'central': 150_000,
'local': 25_000,
'nhs_central': 150_000,
'nhs_local': 25_000,
'nhs_gp': 10_000,
'emergency_service': 25_000,
'school_or_college': 10_000,
'other': 10_000,
}
EMAIL_EXPIRY_SECONDS = 3600 # 1 hour
INVITATION_EXPIRY_SECONDS = 3600 * 24 * 2 # 2 days - also set on api

View File

@@ -6,11 +6,7 @@ from app import billing_api_client, service_api_client
from app.formatters import email_safe
from app.main import main
from app.main.forms import CreateNhsServiceForm, CreateServiceForm
from app.utils import (
get_current_financial_year,
user_is_gov_user,
user_is_logged_in,
)
from app.utils import user_is_gov_user, user_is_logged_in
def _create_service(service_name, organisation_type, email_from, form):
@@ -18,8 +14,6 @@ def _create_service(service_name, organisation_type, email_from, form):
'DEFAULT_FREE_SMS_FRAGMENT_LIMITS'
][
organisation_type
][
get_current_financial_year()
]
try:

View File

@@ -100,22 +100,22 @@ def test_show_different_page_if_user_org_type_is_local(
'test@example.nhs.uk',
))
@pytest.mark.parametrize('inherited, posted, persisted, sms_limit', (
(None, 'central', 'central', 250000),
(None, 'nhs_central', 'nhs_central', 250000),
(None, 'nhs_gp', 'nhs_gp', 25000),
(None, 'central', 'central', 150000),
(None, 'nhs_central', 'nhs_central', 150000),
(None, 'nhs_gp', 'nhs_gp', 10000),
(None, 'nhs_local', 'nhs_local', 25000),
(None, 'local', 'local', 25000),
(None, 'emergency_service', 'emergency_service', 25000),
(None, 'school_or_college', 'school_or_college', 25000),
(None, 'other', 'other', 25000),
('central', None, 'central', 250000),
('nhs_central', None, 'nhs_central', 250000),
(None, 'school_or_college', 'school_or_college', 10000),
(None, 'other', 'other', 10000),
('central', None, 'central', 150000),
('nhs_central', None, 'nhs_central', 150000),
('nhs_local', None, 'nhs_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),
('school_or_college', None, 'school_or_college', 10000),
('other', None, 'other', 10000),
('central', 'local', 'central', 150000),
))
@freeze_time("2021-01-01")
def test_should_add_service_and_redirect_to_tour_when_no_services(
@@ -241,24 +241,15 @@ def test_get_should_only_show_nhs_org_types_radios_if_user_has_nhs_email(
]
@pytest.mark.parametrize('financial_year, organisation_type, free_allowance', [
(2020, 'central', 250_000),
(2020, 'local', 25_000),
(2020, 'nhs_central', 250_000),
(2020, 'nhs_local', 25_000),
(2020, 'nhs_gp', 25_000),
(2020, 'school_or_college', 25_000),
(2020, 'emergency_service', 25_000),
(2020, 'other', 25_000),
(2021, 'central', 150_000),
(2021, 'local', 25_000),
(2021, 'nhs_central', 150_000),
(2021, 'nhs_local', 25_000),
(2021, 'nhs_gp', 10_000),
(2021, 'school_or_college', 10_000),
(2021, 'emergency_service', 25_000),
(2021, 'other', 10_000),
@pytest.mark.parametrize('organisation_type, free_allowance', [
('central', 150_000),
('local', 25_000),
('nhs_central', 150_000),
('nhs_local', 25_000),
('nhs_gp', 10_000),
('school_or_college', 10_000),
('emergency_service', 25_000),
('other', 10_000),
])
def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
app_,
@@ -273,13 +264,7 @@ def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
free_allowance,
mock_create_or_update_free_sms_fragment_limit,
mock_get_all_email_branding,
financial_year,
):
mocker.patch(
'app.main.views.add_service.get_current_financial_year',
return_value=financial_year,
)
client_request.post(
'main.add_service',
_data={