diff --git a/app/notify_client/user_api_client.py b/app/notify_client/user_api_client.py index 7a898ea21..3914999c0 100644 --- a/app/notify_client/user_api_client.py +++ b/app/notify_client/user_api_client.py @@ -214,9 +214,10 @@ class UserApiClient(NotifyAdminAPIClient): def get_services_for_user(self, user): orgs_and_services_for_user = self.get_organisations_and_services_for_user(user) - return orgs_and_services_for_user['services_without_organisations'] + next(chain( + all_services = orgs_and_services_for_user['services_without_organisations'] + next(chain( org['services'] for org in orgs_and_services_for_user['organisations'] ), []) + return sorted(all_services, key=lambda service: service['name']) def get_service_ids_for_user(self, user): return { diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 21cf91ac0..3e525bfe8 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -422,21 +422,6 @@ def test_choose_a_template_to_copy( assert normalize_spaces( page.select_one('main nav').text ) == normalize_spaces( - 'Service 1 ' - ' sms_template_one ' - ' Text message template' - ' sms_template_two Text message template' - ' email_template_one Email template' - ' email_template_two Email template ' - 'Service 2 ' - ' sms_template_one' - ' Text message template' - ' sms_template_two' - ' Text message template' - ' email_template_one' - ' Email template' - ' email_template_two' - ' Email template ' 'Org 1 service 1 ' ' sms_template_one' ' Text message template' @@ -454,6 +439,21 @@ def test_choose_a_template_to_copy( ' email_template_one' ' Email template' ' email_template_two' + ' Email template ' + 'Service 1 ' + ' sms_template_one ' + ' Text message template' + ' sms_template_two Text message template' + ' email_template_one Email template' + ' email_template_two Email template ' + 'Service 2 ' + ' sms_template_one' + ' Text message template' + ' sms_template_two' + ' Text message template' + ' email_template_one' + ' Email template' + ' email_template_two' ' Email template' )