mirror of
https://github.com/GSA/notifications-api.git
synced 2026-04-11 12:49:36 -04:00
Don’t let admin specify branding for new service
It doesn’t need to because the API code works it all out now by looking at the organisation.
This commit is contained in:
@@ -168,7 +168,6 @@ def dao_create_service(
|
||||
user,
|
||||
service_id=None,
|
||||
service_permissions=None,
|
||||
letter_branding=None,
|
||||
):
|
||||
# the default property does not appear to work when there is a difference between the sqlalchemy schema and the
|
||||
# db schema (ie: during a migration), so we have to set sms_sender manually here. After the GOVUK sms_sender
|
||||
@@ -198,9 +197,6 @@ def dao_create_service(
|
||||
# do we just add the default - or will we get a value from FE?
|
||||
insert_service_sms_sender(service, current_app.config['FROM_NUMBER'])
|
||||
|
||||
if letter_branding:
|
||||
service.letter_branding = letter_branding
|
||||
|
||||
if organisation:
|
||||
|
||||
service.organisation = organisation
|
||||
@@ -211,9 +207,8 @@ def dao_create_service(
|
||||
if organisation.letter_branding and not service.letter_branding:
|
||||
service.letter_branding = organisation.letter_branding
|
||||
|
||||
if not organisation and (
|
||||
service.organisation_type == 'nhs' or email_address_is_nhs(user.email_address)
|
||||
):
|
||||
elif service.organisation_type == 'nhs' 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')
|
||||
|
||||
|
||||
@@ -102,25 +102,6 @@ def test_create_service(notify_db_session):
|
||||
assert not service.letter_branding
|
||||
|
||||
|
||||
def test_create_service_with_letter_branding(notify_db_session):
|
||||
user = create_user()
|
||||
create_letter_branding()
|
||||
letter_branding = create_letter_branding(
|
||||
name='test domain', filename='test-domain',
|
||||
)
|
||||
assert Service.query.count() == 0
|
||||
service = Service(name="service_name",
|
||||
email_from="email_from",
|
||||
message_limit=1000,
|
||||
restricted=False,
|
||||
organisation_type='central',
|
||||
created_by=user)
|
||||
dao_create_service(service, user, letter_branding=letter_branding)
|
||||
service_db = Service.query.one()
|
||||
assert service_db.id == service.id
|
||||
assert service.letter_branding == letter_branding
|
||||
|
||||
|
||||
@pytest.mark.parametrize('email_address, organisation_type', (
|
||||
("test@example.gov.uk", 'nhs'),
|
||||
("test@nhs.net", 'nhs'),
|
||||
@@ -155,7 +136,7 @@ def test_create_nhs_service_get_default_branding_based_on_email_address(
|
||||
organisation_type=organisation_type,
|
||||
created_by=user,
|
||||
)
|
||||
dao_create_service(service, user, letter_branding=letter_branding)
|
||||
dao_create_service(service, user)
|
||||
service_db = Service.query.one()
|
||||
|
||||
if expected_branding:
|
||||
|
||||
Reference in New Issue
Block a user