Merge pull request #2557 from alphagov/more_org_types

Introduce new organisation types and organisation_types db table
This commit is contained in:
Pea (Malgorzata Tyczynska)
2019-07-22 14:55:30 +01:00
committed by GitHub
11 changed files with 98 additions and 42 deletions

View File

@@ -158,19 +158,23 @@ def test_update_organisation_updates_the_service_org_type_if_org_type_is_provide
def test_add_service_to_organisation(sample_service, sample_organisation):
sample_service.organisation_type = 'local'
sample_organisation.organisation_type = 'central'
assert sample_organisation.services == []
sample_service.organisation_type = "central"
sample_organisation.organisation_type = "local"
sample_organisation.crown = False
dao_add_service_to_organisation(sample_service, sample_organisation.id)
assert len(sample_organisation.services) == 1
assert sample_organisation.services[0].id == sample_service.id
assert sample_organisation.services[0].organisation_type == 'central'
assert sample_service.organisation_type == sample_organisation.organisation_type
assert sample_service.crown == sample_organisation.crown
assert Service.get_history_model().query.filter_by(
id=sample_service.id,
version=2
).one().organisation_type == 'central'
).one().organisation_type == sample_organisation.organisation_type
def test_add_service_to_multiple_organisation_raises_error(sample_service, sample_organisation):

View File

@@ -105,7 +105,7 @@ def test_create_service(notify_db_session):
assert service.active is True
assert user in service_db.users
assert service_db.organisation_type == 'central'
assert service_db.crown is True
assert service_db.crown is None
assert not service.letter_branding
@@ -389,7 +389,7 @@ def test_get_all_user_services_should_return_empty_list_if_no_services_for_user(
@freeze_time('2019-04-23T10:00:00')
def test_dao_fetch_live_services_data(sample_user):
org = create_organisation(organisation_type='crown')
org = create_organisation(organisation_type='nhs_central')
service = create_service(go_live_user=sample_user, go_live_at='2014-04-20T10:00:00')
template = create_template(service=service)
service_2 = create_service(service_name='second', go_live_at='2017-04-20T10:00:00', go_live_user=sample_user)
@@ -427,7 +427,7 @@ def test_dao_fetch_live_services_data(sample_user):
# checks the results and that they are ordered by date:
assert results == [
{'service_id': mock.ANY, 'service_name': 'Sample service', 'organisation_name': 'test_org_1',
'organisation_type': 'crown', 'consent_to_research': None, 'contact_name': 'Test User',
'organisation_type': 'nhs_central', 'consent_to_research': None, 'contact_name': 'Test User',
'contact_email': 'notify@digital.cabinet-office.gov.uk', 'contact_mobile': '+447700900986',
'live_date': datetime(2014, 4, 20, 10, 0), 'sms_volume_intent': None, 'email_volume_intent': None,
'letter_volume_intent': None, 'sms_totals': 2, 'email_totals': 1, 'letter_totals': 1,