mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-16 20:48:37 -04:00
Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-callback-receipt-1
This commit is contained in:
@@ -87,6 +87,7 @@ def test_create_service(sample_user):
|
||||
email_from="email_from",
|
||||
message_limit=1000,
|
||||
restricted=False,
|
||||
organisation_type='central',
|
||||
created_by=sample_user)
|
||||
dao_create_service(service, sample_user)
|
||||
assert Service.query.count() == 1
|
||||
@@ -96,10 +97,14 @@ def test_create_service(sample_user):
|
||||
assert service_db.id == service.id
|
||||
assert service_db.branding == BRANDING_GOVUK
|
||||
assert service_db.dvla_organisation_id == DVLA_ORG_HM_GOVERNMENT
|
||||
assert service_db.email_from == 'email_from'
|
||||
assert service_db.research_mode is False
|
||||
assert service_db.prefix_sms is True
|
||||
assert service.active is True
|
||||
assert sample_user in service_db.users
|
||||
assert service_db.free_sms_fragment_limit == 250000
|
||||
assert service_db.organisation_type == 'central'
|
||||
assert service_db.crown is True
|
||||
|
||||
|
||||
def test_cannot_create_two_services_with_same_name(sample_user):
|
||||
|
||||
@@ -536,6 +536,26 @@ def test_update_service_flags(client, sample_service):
|
||||
assert set(result['data']['permissions']) == set([LETTER_TYPE, INTERNATIONAL_SMS_TYPE])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("org_type, expected",
|
||||
[("central", True),
|
||||
('local', False),
|
||||
("nhs", False)])
|
||||
def test_update_service_sets_crown(client, sample_service, org_type, expected):
|
||||
data = {
|
||||
'organisation_type': org_type,
|
||||
}
|
||||
auth_header = create_authorization_header()
|
||||
|
||||
resp = client.post(
|
||||
'/service/{}'.format(sample_service.id),
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), auth_header]
|
||||
)
|
||||
result = json.loads(resp.get_data(as_text=True))
|
||||
assert resp.status_code == 200
|
||||
assert result['data']['crown'] is expected
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def service_with_no_permissions(notify_db, notify_db_session):
|
||||
return create_service(service_permissions=[])
|
||||
|
||||
Reference in New Issue
Block a user