#224 remove crown (#228)

Co-authored-by: Kenneth Kehl <@kkehl@flexion.us>
This commit is contained in:
Kenneth Kehl
2023-04-11 13:29:37 -07:00
committed by GitHub
parent 25a89458c8
commit 27d86c949a
16 changed files with 46 additions and 88 deletions

View File

@@ -34,7 +34,7 @@ from tests.app.db import (
def mocker_get_rate(
non_letter_rates, notification_type, local_date, crown=None, rate_multiplier=None
non_letter_rates, notification_type, local_date, rate_multiplier=None
):
if notification_type == SMS_TYPE:
return Decimal(1.33)

View File

@@ -211,8 +211,7 @@ def sample_service(sample_user):
'message_limit': 1000,
'restricted': False,
'email_from': email_from,
'created_by': sample_user,
'crown': True
'created_by': sample_user
}
service = Service.query.filter_by(name=service_name).first()
if not service:

View File

@@ -289,7 +289,7 @@ def test_get_rate_chooses_right_rate_depending_on_date(notify_db_session, date,
create_rate(start_date=datetime(2018, 9, 30, 23, 0), value=2.2, notification_type='sms')
rates = get_rates_for_billing()
rate = get_rate(rates, "sms", date, True)
rate = get_rate(rates, "sms", date)
assert rate == expected_rate

View File

@@ -62,7 +62,6 @@ def test_update_organisation(notify_db_session):
data = {
'name': 'new name',
"crown": True,
"organisation_type": 'state',
"agreement_signed": True,
"agreement_signed_at": datetime.datetime.utcnow(),
@@ -193,26 +192,11 @@ def test_update_organisation_does_not_override_service_branding(
assert sample_service.email_branding == custom_email_branding
def test_update_organisation_updates_services_with_new_crown_type(
sample_service,
sample_organisation
):
sample_organisation.services.append(sample_service)
db.session.commit()
assert Service.query.get(sample_service.id).crown
dao_update_organisation(sample_organisation.id, crown=False)
assert not Service.query.get(sample_service.id).crown
def test_add_service_to_organisation(sample_service, sample_organisation):
assert sample_organisation.services == []
sample_service.organisation_type = "federal"
sample_organisation.organisation_type = "state"
sample_organisation.crown = False
dao_add_service_to_organisation(sample_service, sample_organisation.id)
@@ -220,7 +204,6 @@ def test_add_service_to_organisation(sample_service, sample_organisation):
assert sample_organisation.services[0].id == sample_service.id
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

View File

@@ -102,7 +102,6 @@ def test_create_service(notify_db_session):
assert service.active is True
assert user in service_db.users
assert service_db.organisation_type == 'federal'
assert service_db.crown is None
assert not service.organisation_id
@@ -129,7 +128,6 @@ def test_create_service_with_organisation(notify_db_session):
assert service.active is True
assert user in service_db.users
assert service_db.organisation_type == 'state'
assert service_db.crown is None
assert service.organisation_id == organisation.id
assert service.organisation == organisation

View File

@@ -112,7 +112,6 @@ def create_service(
check_if_service_exists=False,
go_live_user=None,
go_live_at=None,
crown=True,
organisation=None,
purchase_order_number=None,
billing_contact_names=None,
@@ -133,7 +132,6 @@ def create_service(
organisation=organisation,
go_live_user=go_live_user,
go_live_at=go_live_at,
crown=crown,
purchase_order_number=purchase_order_number,
billing_contact_names=billing_contact_names,
billing_contact_email_addresses=billing_contact_email_addresses,

View File

@@ -67,7 +67,6 @@ def test_get_organisation_by_id(admin_request, notify_db_session):
'id',
'name',
'active',
'crown',
'organisation_type',
'agreement_signed',
'agreement_signed_at',
@@ -88,7 +87,6 @@ def test_get_organisation_by_id(admin_request, notify_db_session):
assert response['id'] == str(org.id)
assert response['name'] == 'test_org_1'
assert response['active'] is True
assert response['crown'] is None
assert response['organisation_type'] is None
assert response['agreement_signed'] is None
assert response['agreement_signed_by_id'] is None
@@ -160,12 +158,10 @@ def test_get_organisation_by_domain(
assert response['result'] == 'error'
@pytest.mark.parametrize('crown', [True, False])
def test_post_create_organisation(admin_request, notify_db_session, crown):
def test_post_create_organisation(admin_request, notify_db_session):
data = {
'name': 'test organisation',
'active': True,
'crown': crown,
'organisation_type': 'state',
}
@@ -179,7 +175,6 @@ def test_post_create_organisation(admin_request, notify_db_session, crown):
assert data['name'] == response['name']
assert data['active'] == response['active']
assert data['crown'] == response['crown']
assert data['organisation_type'] == response['organisation_type']
assert len(organisations) == 1
@@ -195,7 +190,6 @@ def test_post_create_organisation_sets_default_nhs_branding_for_nhs_orgs(
data = {
'name': 'test organisation',
'active': True,
'crown': False,
'organisation_type': org_type,
}
@@ -215,7 +209,6 @@ def test_post_create_organisation_existing_name_raises_400(admin_request, sample
data = {
'name': sample_organisation.name,
'active': True,
'crown': True,
'organisation_type': 'federal',
}
@@ -234,29 +227,15 @@ def test_post_create_organisation_existing_name_raises_400(admin_request, sample
@pytest.mark.parametrize('data, expected_error', (
({
'active': False,
'crown': True,
'organisation_type': 'federal',
}, 'name is a required property'),
({
'active': False,
'name': 'Service name',
'organisation_type': 'federal',
}, 'crown is a required property'),
({
'active': False,
'name': 'Service name',
'crown': True,
}, 'organisation_type is a required property'),
({
'active': False,
'name': 'Service name',
'crown': None,
'organisation_type': 'federal',
}, 'crown None is not of type boolean'),
({
'active': False,
'name': 'Service name',
'crown': False,
'organisation_type': 'foo',
}, (
'organisation_type foo is not one of '
@@ -280,22 +259,16 @@ def test_post_create_organisation_with_missing_data_gives_validation_error(
assert response['errors'][0]['message'] == expected_error
@pytest.mark.parametrize('crown', (
None, True, False
))
def test_post_update_organisation_updates_fields(
admin_request,
notify_db_session,
crown,
):
org = create_organisation()
data = {
'name': 'new organisation name',
'active': False,
'crown': crown,
'organisation_type': 'federal',
}
assert org.crown is None
admin_request.post(
'organisation.update_organisation',
@@ -310,7 +283,6 @@ def test_post_update_organisation_updates_fields(
assert organisation[0].id == org.id
assert organisation[0].name == data['name']
assert organisation[0].active == data['active']
assert organisation[0].crown == crown
assert organisation[0].domains == []
assert organisation[0].organisation_type == 'federal'
@@ -327,7 +299,7 @@ def test_post_update_organisation_updates_domains(
):
org = create_organisation(name='test_org_2')
data = {
'domains': domain_list,
'domains': domain_list
}
admin_request.post(
@@ -354,9 +326,7 @@ def test_update_other_organisation_attributes_doesnt_clear_domains(
admin_request.post(
'organisation.update_organisation',
_data={
'crown': True,
},
_data={'domains': ['example.gov.uk']},
organisation_id=org.id,
_expected_status=204
)
@@ -565,7 +535,7 @@ def test_post_update_organisation_set_mou_emails_signed_by(
for n in notifications:
# we pass in the same personalisation for all templates (though some templates don't use all fields)
assert n.personalisation == {
'mou_link': 'http://localhost:6012/agreement/non-crown.pdf',
'mou_link': 'http://localhost:6012/agreement/agreement.pdf',
'org_name': 'sample organisation',
'org_dashboard_link': 'http://localhost:6012/organisations/{}'.format(sample_organisation.id),
'signed_by_name': 'Test User',