mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
update tests
This commit is contained in:
@@ -65,7 +65,7 @@ def test_update_organisation(notify_db_session):
|
||||
data = {
|
||||
'name': 'new name',
|
||||
"crown": True,
|
||||
"organisation_type": 'local',
|
||||
"organisation_type": 'state',
|
||||
"agreement_signed": True,
|
||||
"agreement_signed_at": datetime.datetime.utcnow(),
|
||||
"agreement_signed_by_id": user.id,
|
||||
@@ -124,8 +124,8 @@ def test_update_organisation_does_not_update_the_service_if_certain_attributes_n
|
||||
email_branding = create_email_branding()
|
||||
letter_branding = create_letter_branding()
|
||||
|
||||
sample_service.organisation_type = 'local'
|
||||
sample_organisation.organisation_type = 'central'
|
||||
sample_service.organisation_type = 'state'
|
||||
sample_organisation.organisation_type = 'federal'
|
||||
sample_organisation.email_branding = email_branding
|
||||
sample_organisation.letter_branding = letter_branding
|
||||
|
||||
@@ -138,8 +138,8 @@ def test_update_organisation_does_not_update_the_service_if_certain_attributes_n
|
||||
|
||||
assert sample_organisation.name == 'updated org name'
|
||||
|
||||
assert sample_organisation.organisation_type == 'central'
|
||||
assert sample_service.organisation_type == 'local'
|
||||
assert sample_organisation.organisation_type == 'federal'
|
||||
assert sample_service.organisation_type == 'state'
|
||||
|
||||
assert sample_organisation.email_branding == email_branding
|
||||
assert sample_service.email_branding is None
|
||||
@@ -152,20 +152,20 @@ def test_update_organisation_updates_the_service_org_type_if_org_type_is_provide
|
||||
sample_service,
|
||||
sample_organisation,
|
||||
):
|
||||
sample_service.organisation_type = 'local'
|
||||
sample_organisation.organisation_type = 'local'
|
||||
sample_service.organisation_type = 'state'
|
||||
sample_organisation.organisation_type = 'state'
|
||||
|
||||
sample_organisation.services.append(sample_service)
|
||||
db.session.commit()
|
||||
|
||||
dao_update_organisation(sample_organisation.id, organisation_type='central')
|
||||
dao_update_organisation(sample_organisation.id, organisation_type='federal')
|
||||
|
||||
assert sample_organisation.organisation_type == 'central'
|
||||
assert sample_service.organisation_type == 'central'
|
||||
assert sample_organisation.organisation_type == 'federal'
|
||||
assert sample_service.organisation_type == 'federal'
|
||||
assert Service.get_history_model().query.filter_by(
|
||||
id=sample_service.id,
|
||||
version=2
|
||||
).one().organisation_type == 'central'
|
||||
).one().organisation_type == 'federal'
|
||||
|
||||
|
||||
def test_update_organisation_updates_the_service_branding_if_branding_is_provided(
|
||||
@@ -228,8 +228,8 @@ def test_update_organisation_updates_services_with_new_crown_type(
|
||||
def test_add_service_to_organisation(sample_service, sample_organisation):
|
||||
assert sample_organisation.services == []
|
||||
|
||||
sample_service.organisation_type = "central"
|
||||
sample_organisation.organisation_type = "local"
|
||||
sample_service.organisation_type = "federal"
|
||||
sample_organisation.organisation_type = "state"
|
||||
sample_organisation.crown = False
|
||||
|
||||
dao_add_service_to_organisation(sample_service, sample_organisation.id)
|
||||
|
||||
@@ -98,7 +98,7 @@ def test_create_service(notify_db_session):
|
||||
email_from="email_from",
|
||||
message_limit=1000,
|
||||
restricted=False,
|
||||
organisation_type='central',
|
||||
organisation_type='federal',
|
||||
created_by=user)
|
||||
dao_create_service(service, user)
|
||||
assert Service.query.count() == 1
|
||||
@@ -110,7 +110,7 @@ def test_create_service(notify_db_session):
|
||||
assert service_db.prefix_sms is True
|
||||
assert service.active is True
|
||||
assert user in service_db.users
|
||||
assert service_db.organisation_type == 'central'
|
||||
assert service_db.organisation_type == 'federal'
|
||||
assert service_db.crown is None
|
||||
assert not service.letter_branding
|
||||
assert not service.organisation_id
|
||||
@@ -119,13 +119,13 @@ def test_create_service(notify_db_session):
|
||||
def test_create_service_with_organisation(notify_db_session):
|
||||
user = create_user(email='local.authority@local-authority.gov.uk')
|
||||
organisation = create_organisation(
|
||||
name='Some local authority', organisation_type='local', domains=['local-authority.gov.uk'])
|
||||
name='Some local authority', organisation_type='state', domains=['local-authority.gov.uk'])
|
||||
assert Service.query.count() == 0
|
||||
service = Service(name="service_name",
|
||||
email_from="email_from",
|
||||
message_limit=1000,
|
||||
restricted=False,
|
||||
organisation_type='central',
|
||||
organisation_type='federal',
|
||||
created_by=user)
|
||||
dao_create_service(service, user)
|
||||
assert Service.query.count() == 1
|
||||
@@ -138,7 +138,7 @@ def test_create_service_with_organisation(notify_db_session):
|
||||
assert service_db.prefix_sms is True
|
||||
assert service.active is True
|
||||
assert user in service_db.users
|
||||
assert service_db.organisation_type == 'local'
|
||||
assert service_db.organisation_type == 'state'
|
||||
assert service_db.crown is None
|
||||
assert not service.letter_branding
|
||||
assert service.organisation_id == organisation.id
|
||||
@@ -447,7 +447,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='nhs_central')
|
||||
org = create_organisation(organisation_type='federal')
|
||||
service = create_service(go_live_user=sample_user, go_live_at='2014-04-20T10:00:00')
|
||||
sms_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)
|
||||
@@ -485,7 +485,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': 'nhs_central', 'consent_to_research': None, 'contact_name': 'Test User',
|
||||
'organisation_type': 'federal', '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,
|
||||
|
||||
Reference in New Issue
Block a user