mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 07:46:06 -04:00
swap out uk org types for us-specific org types
This commit is contained in:
@@ -89,7 +89,7 @@ def _create_p1_zendesk_alert(broadcast_message):
|
|||||||
ticket_type=NotifySupportTicket.TYPE_INCIDENT,
|
ticket_type=NotifySupportTicket.TYPE_INCIDENT,
|
||||||
technical_ticket=True,
|
technical_ticket=True,
|
||||||
org_id=current_app.config['BROADCAST_ORGANISATION_ID'],
|
org_id=current_app.config['BROADCAST_ORGANISATION_ID'],
|
||||||
org_type='central',
|
org_type='federal',
|
||||||
service_id=str(broadcast_message.service_id),
|
service_id=str(broadcast_message.service_id),
|
||||||
p1=True
|
p1=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ def replay_daily_sorted_count_files(file_extension):
|
|||||||
help="Pipe delimited file containing organisation name, sector, crown, argeement_signed, domains")
|
help="Pipe delimited file containing organisation name, sector, crown, argeement_signed, domains")
|
||||||
def populate_organisations_from_file(file_name):
|
def populate_organisations_from_file(file_name):
|
||||||
# [0] organisation name:: name of the organisation insert if organisation is missing.
|
# [0] organisation name:: name of the organisation insert if organisation is missing.
|
||||||
# [1] sector:: Central | Local | NHS only
|
# [1] sector:: Federal | State only
|
||||||
# [2] crown:: TRUE | FALSE only
|
# [2] crown:: TRUE | FALSE only
|
||||||
# [3] argeement_signed:: TRUE | FALSE
|
# [3] argeement_signed:: TRUE | FALSE
|
||||||
# [4] domains:: comma separated list of domains related to the organisation
|
# [4] domains:: comma separated list of domains related to the organisation
|
||||||
|
|||||||
@@ -55,46 +55,21 @@ def dao_get_all_free_sms_fragment_limit(service_id):
|
|||||||
|
|
||||||
def set_default_free_allowance_for_service(service, year_start=None):
|
def set_default_free_allowance_for_service(service, year_start=None):
|
||||||
default_free_sms_fragment_limits = {
|
default_free_sms_fragment_limits = {
|
||||||
'central': {
|
'federal': {
|
||||||
2020: 250_000,
|
2020: 250_000,
|
||||||
2021: 150_000,
|
2021: 150_000,
|
||||||
2022: 40_000,
|
2022: 40_000,
|
||||||
},
|
},
|
||||||
'local': {
|
'state': {
|
||||||
2020: 25_000,
|
|
||||||
2021: 25_000,
|
|
||||||
2022: 20_000,
|
|
||||||
},
|
|
||||||
'nhs_central': {
|
|
||||||
2020: 250_000,
|
2020: 250_000,
|
||||||
2021: 150_000,
|
2021: 150_000,
|
||||||
2022: 40_000,
|
2022: 40_000,
|
||||||
},
|
},
|
||||||
'nhs_local': {
|
|
||||||
2020: 25_000,
|
|
||||||
2021: 25_000,
|
|
||||||
2022: 20_000,
|
|
||||||
},
|
|
||||||
'nhs_gp': {
|
|
||||||
2020: 25_000,
|
|
||||||
2021: 10_000,
|
|
||||||
2022: 10_000,
|
|
||||||
},
|
|
||||||
'emergency_service': {
|
|
||||||
2020: 25_000,
|
|
||||||
2021: 25_000,
|
|
||||||
2022: 20_000,
|
|
||||||
},
|
|
||||||
'school_or_college': {
|
|
||||||
2020: 25_000,
|
|
||||||
2021: 10_000,
|
|
||||||
2022: 10_000,
|
|
||||||
},
|
|
||||||
'other': {
|
'other': {
|
||||||
2020: 25_000,
|
2020: 250_000,
|
||||||
2021: 10_000,
|
2021: 150_000,
|
||||||
2022: 10_000,
|
2022: 40_000,
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
if not year_start:
|
if not year_start:
|
||||||
year_start = get_current_financial_year_start_year()
|
year_start = get_current_financial_year_start_year()
|
||||||
|
|||||||
@@ -16,14 +16,11 @@ from app.dao.service_sms_sender_dao import insert_service_sms_sender
|
|||||||
from app.dao.service_user_dao import dao_get_service_user
|
from app.dao.service_user_dao import dao_get_service_user
|
||||||
from app.dao.template_folder_dao import dao_get_valid_template_folders_by_id
|
from app.dao.template_folder_dao import dao_get_valid_template_folders_by_id
|
||||||
from app.models import (
|
from app.models import (
|
||||||
CROWN_ORGANISATION_TYPES,
|
|
||||||
EMAIL_TYPE,
|
EMAIL_TYPE,
|
||||||
INTERNATIONAL_LETTERS,
|
INTERNATIONAL_LETTERS,
|
||||||
INTERNATIONAL_SMS_TYPE,
|
INTERNATIONAL_SMS_TYPE,
|
||||||
KEY_TYPE_TEST,
|
KEY_TYPE_TEST,
|
||||||
LETTER_TYPE,
|
LETTER_TYPE,
|
||||||
NHS_ORGANISATION_TYPES,
|
|
||||||
NON_CROWN_ORGANISATION_TYPES,
|
|
||||||
NOTIFICATION_PERMANENT_FAILURE,
|
NOTIFICATION_PERMANENT_FAILURE,
|
||||||
SMS_TYPE,
|
SMS_TYPE,
|
||||||
UPLOAD_LETTERS,
|
UPLOAD_LETTERS,
|
||||||
@@ -324,16 +321,8 @@ def dao_create_service(
|
|||||||
if organisation.letter_branding:
|
if organisation.letter_branding:
|
||||||
service.letter_branding = organisation.letter_branding
|
service.letter_branding = organisation.letter_branding
|
||||||
|
|
||||||
elif service.organisation_type in NHS_ORGANISATION_TYPES or email_address_is_nhs(user.email_address):
|
|
||||||
service.email_branding = dao_get_email_branding_by_name('NHS')
|
|
||||||
service.letter_branding = dao_get_letter_branding_by_name('NHS')
|
|
||||||
|
|
||||||
if organisation:
|
if organisation:
|
||||||
service.crown = organisation.crown
|
service.crown = organisation.crown
|
||||||
elif service.organisation_type in CROWN_ORGANISATION_TYPES:
|
|
||||||
service.crown = True
|
|
||||||
elif service.organisation_type in NON_CROWN_ORGANISATION_TYPES:
|
|
||||||
service.crown = False
|
|
||||||
service.count_as_live = not user.platform_admin
|
service.count_as_live = not user.platform_admin
|
||||||
|
|
||||||
db.session.add(service)
|
db.session.add(service)
|
||||||
|
|||||||
@@ -352,12 +352,12 @@ class Domain(db.Model):
|
|||||||
|
|
||||||
|
|
||||||
ORGANISATION_TYPES = [
|
ORGANISATION_TYPES = [
|
||||||
"central", "local", "nhs_central", "nhs_local", "nhs_gp", "emergency_service", "school_or_college", "other",
|
"federal", "state", "other"
|
||||||
]
|
]
|
||||||
|
|
||||||
CROWN_ORGANISATION_TYPES = ["nhs_central"]
|
# CROWN_ORGANISATION_TYPES = ["nhs_central"]
|
||||||
NON_CROWN_ORGANISATION_TYPES = ["local", "nhs_local", "nhs_gp", "emergency_service", "school_or_college"]
|
# NON_CROWN_ORGANISATION_TYPES = ["local", "nhs_local", "nhs_gp", "emergency_service", "school_or_college"]
|
||||||
NHS_ORGANISATION_TYPES = ["nhs_central", "nhs_local", "nhs_gp"]
|
# NHS_ORGANISATION_TYPES = ["nhs_central", "nhs_local", "nhs_gp"]
|
||||||
|
|
||||||
|
|
||||||
class OrganisationTypes(db.Model):
|
class OrganisationTypes(db.Model):
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from app.dao.services_dao import dao_fetch_service_by_id
|
|||||||
from app.dao.templates_dao import dao_get_template_by_id
|
from app.dao.templates_dao import dao_get_template_by_id
|
||||||
from app.dao.users_dao import get_user_by_id
|
from app.dao.users_dao import get_user_by_id
|
||||||
from app.errors import InvalidRequest, register_errors
|
from app.errors import InvalidRequest, register_errors
|
||||||
from app.models import KEY_TYPE_NORMAL, NHS_ORGANISATION_TYPES, Organisation
|
from app.models import KEY_TYPE_NORMAL, Organisation
|
||||||
from app.notifications.process_notifications import (
|
from app.notifications.process_notifications import (
|
||||||
persist_notification,
|
persist_notification,
|
||||||
send_notification_to_queue,
|
send_notification_to_queue,
|
||||||
@@ -93,9 +93,6 @@ def create_organisation():
|
|||||||
|
|
||||||
validate(data, post_create_organisation_schema)
|
validate(data, post_create_organisation_schema)
|
||||||
|
|
||||||
if data["organisation_type"] in NHS_ORGANISATION_TYPES:
|
|
||||||
data["email_branding_id"] = current_app.config['NHS_EMAIL_BRANDING_ID']
|
|
||||||
|
|
||||||
organisation = Organisation(**data)
|
organisation = Organisation(**data)
|
||||||
dao_create_organisation(organisation)
|
dao_create_organisation(organisation)
|
||||||
return jsonify(organisation.serialize()), 201
|
return jsonify(organisation.serialize()), 201
|
||||||
@@ -108,9 +105,6 @@ def update_organisation(organisation_id):
|
|||||||
|
|
||||||
organisation = dao_get_organisation_by_id(organisation_id)
|
organisation = dao_get_organisation_by_id(organisation_id)
|
||||||
|
|
||||||
if data.get('organisation_type') in NHS_ORGANISATION_TYPES and not organisation.email_branding_id:
|
|
||||||
data["email_branding_id"] = current_app.config['NHS_EMAIL_BRANDING_ID']
|
|
||||||
|
|
||||||
result = dao_update_organisation(organisation_id, **data)
|
result = dao_update_organisation(organisation_id, **data)
|
||||||
|
|
||||||
if data.get('agreement_signed') is True:
|
if data.get('agreement_signed') is True:
|
||||||
|
|||||||
29
migrations/versions/0376_add_org_names.py
Normal file
29
migrations/versions/0376_add_org_names.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
"""
|
||||||
|
|
||||||
|
Revision ID: 0376_add_org_names
|
||||||
|
Revises: 0375_fix_service_name
|
||||||
|
Create Date: 2022-09-23 20:04:00.766980
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
revision = '0376_add_org_names'
|
||||||
|
down_revision = '0375_fix_service_name'
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.get_bind()
|
||||||
|
|
||||||
|
op.execute("INSERT INTO organisation_types VALUES ('state','f','250000'),('federal','f','250000');")
|
||||||
|
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
pass
|
||||||
|
# ### end Alembic commands ###
|
||||||
@@ -108,7 +108,7 @@ def test_get_free_sms_fragment_limit_current_year_creates_new_row_if_annual_bill
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert json_response['financial_year_start'] == 2021
|
assert json_response['financial_year_start'] == 2021
|
||||||
assert json_response['free_sms_fragment_limit'] == 10000 # based on other organisation type
|
assert json_response['free_sms_fragment_limit'] == 150000 # based on other organisation type
|
||||||
|
|
||||||
|
|
||||||
def test_update_free_sms_fragment_limit_data(client, sample_service):
|
def test_update_free_sms_fragment_limit_data(client, sample_service):
|
||||||
|
|||||||
@@ -47,31 +47,17 @@ def test_dao_update_annual_billing_for_future_years(notify_db_session, sample_se
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('org_type, year, expected_default',
|
@pytest.mark.parametrize('org_type, year, expected_default',
|
||||||
[('central', 2021, 150000),
|
[('federal', 2021, 150000),
|
||||||
('local', 2021, 25000),
|
('state', 2021, 150000),
|
||||||
('nhs_central', 2021, 150000),
|
(None, 2021, 150000),
|
||||||
('nhs_local', 2021, 25000),
|
('federal', 2020, 250000),
|
||||||
('nhs_gp', 2021, 10000),
|
('state', 2020, 250000),
|
||||||
('emergency_service', 2021, 25000),
|
('other', 2020, 250000),
|
||||||
('school_or_college', 2021, 10000),
|
(None, 2020, 250000),
|
||||||
('other', 2021, 10000),
|
('federal', 2019, 250000),
|
||||||
(None, 2021, 10000),
|
('federal', 2022, 40000),
|
||||||
('central', 2020, 250000),
|
('state', 2022, 40000),
|
||||||
('local', 2020, 25000),
|
('federal', 2023, 40000),
|
||||||
('nhs_central', 2020, 250000),
|
|
||||||
('nhs_local', 2020, 25000),
|
|
||||||
('nhs_gp', 2020, 25000),
|
|
||||||
('emergency_service', 2020, 25000),
|
|
||||||
('school_or_college', 2020, 25000),
|
|
||||||
('other', 2020, 25000),
|
|
||||||
(None, 2020, 25000),
|
|
||||||
('central', 2019, 250000),
|
|
||||||
('school_or_college', 2022, 10000),
|
|
||||||
('central', 2022, 40000),
|
|
||||||
('local', 2022, 20000),
|
|
||||||
('nhs_local', 2022, 20000),
|
|
||||||
('emergency_service', 2022, 20000),
|
|
||||||
('central', 2023, 40000),
|
|
||||||
])
|
])
|
||||||
def test_set_default_free_allowance_for_service(notify_db_session, org_type, year, expected_default):
|
def test_set_default_free_allowance_for_service(notify_db_session, org_type, year, expected_default):
|
||||||
|
|
||||||
@@ -93,7 +79,7 @@ def test_set_default_free_allowance_for_service_using_correct_year(sample_servic
|
|||||||
|
|
||||||
mock_dao.assert_called_once_with(
|
mock_dao.assert_called_once_with(
|
||||||
sample_service.id,
|
sample_service.id,
|
||||||
25000,
|
250000,
|
||||||
2020
|
2020
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -105,9 +91,9 @@ def test_set_default_free_allowance_for_service_updates_existing_year(sample_ser
|
|||||||
assert not sample_service.organisation_type
|
assert not sample_service.organisation_type
|
||||||
assert len(annual_billing) == 1
|
assert len(annual_billing) == 1
|
||||||
assert annual_billing[0].service_id == sample_service.id
|
assert annual_billing[0].service_id == sample_service.id
|
||||||
assert annual_billing[0].free_sms_fragment_limit == 10000
|
assert annual_billing[0].free_sms_fragment_limit == 150000
|
||||||
|
|
||||||
sample_service.organisation_type = 'central'
|
sample_service.organisation_type = 'federal'
|
||||||
|
|
||||||
set_default_free_allowance_for_service(service=sample_service, year_start=None)
|
set_default_free_allowance_for_service(service=sample_service, year_start=None)
|
||||||
annual_billing = AnnualBilling.query.all()
|
annual_billing = AnnualBilling.query.all()
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ def test_create_service_with_organisation(notify_db_session):
|
|||||||
# the NHS branding set up
|
# the NHS branding set up
|
||||||
('SHN', False),
|
('SHN', False),
|
||||||
))
|
))
|
||||||
|
@pytest.mark.skip(reason='Update for TTS')
|
||||||
def test_create_nhs_service_get_default_branding_based_on_email_address(
|
def test_create_nhs_service_get_default_branding_based_on_email_address(
|
||||||
notify_db_session,
|
notify_db_session,
|
||||||
branding_name_to_create,
|
branding_name_to_create,
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ def create_service(
|
|||||||
email_from=None,
|
email_from=None,
|
||||||
prefix_sms=True,
|
prefix_sms=True,
|
||||||
message_limit=1000,
|
message_limit=1000,
|
||||||
organisation_type='central',
|
organisation_type='federal',
|
||||||
check_if_service_exists=False,
|
check_if_service_exists=False,
|
||||||
go_live_user=None,
|
go_live_user=None,
|
||||||
go_live_at=None,
|
go_live_at=None,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ from tests.app.db import (
|
|||||||
|
|
||||||
|
|
||||||
def test_get_all_organisations(admin_request, notify_db_session):
|
def test_get_all_organisations(admin_request, notify_db_session):
|
||||||
create_organisation(name='inactive org', active=False, organisation_type='nhs_central')
|
create_organisation(name='inactive org', active=False, organisation_type='federal')
|
||||||
create_organisation(name='active org', domains=['example.com'])
|
create_organisation(name='active org', domains=['example.com'])
|
||||||
|
|
||||||
response = admin_request.get(
|
response = admin_request.get(
|
||||||
@@ -52,7 +52,7 @@ def test_get_all_organisations(admin_request, notify_db_session):
|
|||||||
assert response[1]['active'] is False
|
assert response[1]['active'] is False
|
||||||
assert response[1]['count_of_live_services'] == 0
|
assert response[1]['count_of_live_services'] == 0
|
||||||
assert response[1]['domains'] == []
|
assert response[1]['domains'] == []
|
||||||
assert response[1]['organisation_type'] == 'nhs_central'
|
assert response[1]['organisation_type'] == 'federal'
|
||||||
|
|
||||||
|
|
||||||
def test_get_organisation_by_id(admin_request, notify_db_session):
|
def test_get_organisation_by_id(admin_request, notify_db_session):
|
||||||
@@ -169,7 +169,7 @@ def test_post_create_organisation(admin_request, notify_db_session, crown):
|
|||||||
'name': 'test organisation',
|
'name': 'test organisation',
|
||||||
'active': True,
|
'active': True,
|
||||||
'crown': crown,
|
'crown': crown,
|
||||||
'organisation_type': 'local',
|
'organisation_type': 'state',
|
||||||
}
|
}
|
||||||
|
|
||||||
response = admin_request.post(
|
response = admin_request.post(
|
||||||
@@ -191,6 +191,7 @@ def test_post_create_organisation(admin_request, notify_db_session, crown):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('org_type', ["nhs_central", "nhs_local", "nhs_gp"])
|
@pytest.mark.parametrize('org_type', ["nhs_central", "nhs_local", "nhs_gp"])
|
||||||
|
@pytest.mark.skip(reason='Update for TTS')
|
||||||
def test_post_create_organisation_sets_default_nhs_branding_for_nhs_orgs(
|
def test_post_create_organisation_sets_default_nhs_branding_for_nhs_orgs(
|
||||||
admin_request, notify_db_session, nhs_email_branding, org_type
|
admin_request, notify_db_session, nhs_email_branding, org_type
|
||||||
):
|
):
|
||||||
@@ -218,7 +219,7 @@ def test_post_create_organisation_existing_name_raises_400(admin_request, sample
|
|||||||
'name': sample_organisation.name,
|
'name': sample_organisation.name,
|
||||||
'active': True,
|
'active': True,
|
||||||
'crown': True,
|
'crown': True,
|
||||||
'organisation_type': 'central',
|
'organisation_type': 'federal',
|
||||||
}
|
}
|
||||||
|
|
||||||
response = admin_request.post(
|
response = admin_request.post(
|
||||||
@@ -237,12 +238,12 @@ def test_post_create_organisation_existing_name_raises_400(admin_request, sample
|
|||||||
({
|
({
|
||||||
'active': False,
|
'active': False,
|
||||||
'crown': True,
|
'crown': True,
|
||||||
'organisation_type': 'central',
|
'organisation_type': 'federal',
|
||||||
}, 'name is a required property'),
|
}, 'name is a required property'),
|
||||||
({
|
({
|
||||||
'active': False,
|
'active': False,
|
||||||
'name': 'Service name',
|
'name': 'Service name',
|
||||||
'organisation_type': 'central',
|
'organisation_type': 'federal',
|
||||||
}, 'crown is a required property'),
|
}, 'crown is a required property'),
|
||||||
({
|
({
|
||||||
'active': False,
|
'active': False,
|
||||||
@@ -253,7 +254,7 @@ def test_post_create_organisation_existing_name_raises_400(admin_request, sample
|
|||||||
'active': False,
|
'active': False,
|
||||||
'name': 'Service name',
|
'name': 'Service name',
|
||||||
'crown': None,
|
'crown': None,
|
||||||
'organisation_type': 'central',
|
'organisation_type': 'federal',
|
||||||
}, 'crown None is not of type boolean'),
|
}, 'crown None is not of type boolean'),
|
||||||
({
|
({
|
||||||
'active': False,
|
'active': False,
|
||||||
@@ -262,7 +263,7 @@ def test_post_create_organisation_existing_name_raises_400(admin_request, sample
|
|||||||
'organisation_type': 'foo',
|
'organisation_type': 'foo',
|
||||||
}, (
|
}, (
|
||||||
'organisation_type foo is not one of '
|
'organisation_type foo is not one of '
|
||||||
'[central, local, nhs_central, nhs_local, nhs_gp, emergency_service, school_or_college, other]'
|
'[federal, state, other]'
|
||||||
)),
|
)),
|
||||||
))
|
))
|
||||||
def test_post_create_organisation_with_missing_data_gives_validation_error(
|
def test_post_create_organisation_with_missing_data_gives_validation_error(
|
||||||
@@ -295,7 +296,7 @@ def test_post_update_organisation_updates_fields(
|
|||||||
'name': 'new organisation name',
|
'name': 'new organisation name',
|
||||||
'active': False,
|
'active': False,
|
||||||
'crown': crown,
|
'crown': crown,
|
||||||
'organisation_type': 'central',
|
'organisation_type': 'federal',
|
||||||
}
|
}
|
||||||
assert org.crown is None
|
assert org.crown is None
|
||||||
|
|
||||||
@@ -314,7 +315,7 @@ def test_post_update_organisation_updates_fields(
|
|||||||
assert organisation[0].active == data['active']
|
assert organisation[0].active == data['active']
|
||||||
assert organisation[0].crown == crown
|
assert organisation[0].crown == crown
|
||||||
assert organisation[0].domains == []
|
assert organisation[0].domains == []
|
||||||
assert organisation[0].organisation_type == 'central'
|
assert organisation[0].organisation_type == 'federal'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('domain_list', (
|
@pytest.mark.parametrize('domain_list', (
|
||||||
@@ -371,6 +372,7 @@ def test_update_other_organisation_attributes_doesnt_clear_domains(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('new_org_type', ["nhs_central", "nhs_local", "nhs_gp"])
|
@pytest.mark.parametrize('new_org_type', ["nhs_central", "nhs_local", "nhs_gp"])
|
||||||
|
@pytest.mark.skip(reason='Update for TTS')
|
||||||
def test_post_update_organisation_to_nhs_type_updates_branding_if_none_present(
|
def test_post_update_organisation_to_nhs_type_updates_branding_if_none_present(
|
||||||
admin_request,
|
admin_request,
|
||||||
nhs_email_branding,
|
nhs_email_branding,
|
||||||
@@ -398,6 +400,7 @@ def test_post_update_organisation_to_nhs_type_updates_branding_if_none_present(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('new_org_type', ["nhs_central", "nhs_local", "nhs_gp"])
|
@pytest.mark.parametrize('new_org_type', ["nhs_central", "nhs_local", "nhs_gp"])
|
||||||
|
@pytest.mark.skip(reason='Update for TTS')
|
||||||
def test_post_update_organisation_to_nhs_type_does_not_update_branding_if_default_branding_set(
|
def test_post_update_organisation_to_nhs_type_does_not_update_branding_if_default_branding_set(
|
||||||
admin_request,
|
admin_request,
|
||||||
nhs_email_branding,
|
nhs_email_branding,
|
||||||
@@ -581,7 +584,7 @@ def test_post_link_service_to_organisation(admin_request, sample_service):
|
|||||||
data = {
|
data = {
|
||||||
'service_id': str(sample_service.id)
|
'service_id': str(sample_service.id)
|
||||||
}
|
}
|
||||||
organisation = create_organisation(organisation_type='central')
|
organisation = create_organisation(organisation_type='federal')
|
||||||
|
|
||||||
admin_request.post(
|
admin_request.post(
|
||||||
'organisation.link_service_to_organisation',
|
'organisation.link_service_to_organisation',
|
||||||
@@ -590,7 +593,7 @@ def test_post_link_service_to_organisation(admin_request, sample_service):
|
|||||||
_expected_status=204
|
_expected_status=204
|
||||||
)
|
)
|
||||||
assert len(organisation.services) == 1
|
assert len(organisation.services) == 1
|
||||||
assert sample_service.organisation_type == 'central'
|
assert sample_service.organisation_type == 'federal'
|
||||||
|
|
||||||
|
|
||||||
@freeze_time('2021-09-24 13:30')
|
@freeze_time('2021-09-24 13:30')
|
||||||
@@ -598,7 +601,7 @@ def test_post_link_service_to_organisation_inserts_annual_billing(admin_request,
|
|||||||
data = {
|
data = {
|
||||||
'service_id': str(sample_service.id)
|
'service_id': str(sample_service.id)
|
||||||
}
|
}
|
||||||
organisation = create_organisation(organisation_type='central')
|
organisation = create_organisation(organisation_type='federal')
|
||||||
assert len(organisation.services) == 0
|
assert len(organisation.services) == 0
|
||||||
assert len(AnnualBilling.query.all()) == 0
|
assert len(AnnualBilling.query.all()) == 0
|
||||||
admin_request.post(
|
admin_request.post(
|
||||||
@@ -623,7 +626,7 @@ def test_post_link_service_to_organisation_rollback_service_if_annual_billing_up
|
|||||||
}
|
}
|
||||||
assert not sample_service.organisation_type
|
assert not sample_service.organisation_type
|
||||||
|
|
||||||
organisation = create_organisation(organisation_type='central')
|
organisation = create_organisation(organisation_type='federal')
|
||||||
assert len(organisation.services) == 0
|
assert len(organisation.services) == 0
|
||||||
assert len(AnnualBilling.query.all()) == 0
|
assert len(AnnualBilling.query.all()) == 0
|
||||||
with pytest.raises(expected_exception=SQLAlchemyError):
|
with pytest.raises(expected_exception=SQLAlchemyError):
|
||||||
@@ -655,7 +658,7 @@ def test_post_link_service_to_another_org(
|
|||||||
assert len(sample_organisation.services) == 1
|
assert len(sample_organisation.services) == 1
|
||||||
assert not sample_service.organisation_type
|
assert not sample_service.organisation_type
|
||||||
|
|
||||||
new_org = create_organisation(organisation_type='central')
|
new_org = create_organisation(organisation_type='federal')
|
||||||
admin_request.post(
|
admin_request.post(
|
||||||
'organisation.link_service_to_organisation',
|
'organisation.link_service_to_organisation',
|
||||||
_data=data,
|
_data=data,
|
||||||
@@ -664,7 +667,7 @@ def test_post_link_service_to_another_org(
|
|||||||
)
|
)
|
||||||
assert not sample_organisation.services
|
assert not sample_organisation.services
|
||||||
assert len(new_org.services) == 1
|
assert len(new_org.services) == 1
|
||||||
assert sample_service.organisation_type == 'central'
|
assert sample_service.organisation_type == 'federal'
|
||||||
annual_billing = AnnualBilling.query.all()
|
annual_billing = AnnualBilling.query.all()
|
||||||
assert len(annual_billing) == 1
|
assert len(annual_billing) == 1
|
||||||
assert annual_billing[0].free_sms_fragment_limit == 150000
|
assert annual_billing[0].free_sms_fragment_limit == 150000
|
||||||
|
|||||||
@@ -43,9 +43,8 @@ def test_local_dev_broadcast_permissions(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("organisation_type, expected_allowance",
|
@pytest.mark.parametrize("organisation_type, expected_allowance",
|
||||||
[('central', 40000),
|
[('federal', 40000),
|
||||||
('local', 20000),
|
('state', 40000)])
|
||||||
('nhs_gp', 10000)])
|
|
||||||
def test_populate_annual_billing_with_defaults(
|
def test_populate_annual_billing_with_defaults(
|
||||||
notify_db_session, notify_api, organisation_type, expected_allowance
|
notify_db_session, notify_api, organisation_type, expected_allowance
|
||||||
):
|
):
|
||||||
|
|||||||
Reference in New Issue
Block a user