From 2f4f381fa4085725be56a5683605584fd0812b8c Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 13 Dec 2018 11:09:47 +0000 Subject: [PATCH] Include live/trial mode in list of services We need this so we can check in the admin whether users have any live services. --- app/user/rest.py | 6 ++++-- tests/app/user/test_rest.py | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/user/rest.py b/app/user/rest.py index 0bca01a4c..65097b6d4 100644 --- a/app/user/rest.py +++ b/app/user/rest.py @@ -449,7 +449,8 @@ def get_orgs_and_services(user): 'services': [ { 'id': service.id, - 'name': service.name + 'name': service.name, + 'restricted': service.restricted, } for service in org.services if service.active and service in user.services @@ -460,7 +461,8 @@ def get_orgs_and_services(user): 'services_without_organisations': [ { 'id': service.id, - 'name': service.name + 'name': service.name, + 'restricted': service.restricted, } for service in user.services if ( service.active and diff --git a/tests/app/user/test_rest.py b/tests/app/user/test_rest.py index 1db989706..32222581a 100644 --- a/tests/app/user/test_rest.py +++ b/tests/app/user/test_rest.py @@ -631,11 +631,13 @@ def test_get_orgs_and_services_nests_services(admin_request, sample_user): 'services': [ { 'name': service1.name, - 'id': str(service1.id) + 'id': str(service1.id), + 'restricted': False, }, { 'name': service2.name, - 'id': str(service2.id) + 'id': str(service2.id), + 'restricted': False, } ] }, @@ -648,7 +650,8 @@ def test_get_orgs_and_services_nests_services(admin_request, sample_user): 'services_without_organisations': [ { 'name': service3.name, - 'id': str(service3.id) + 'id': str(service3.id), + 'restricted': False, } ] } @@ -683,7 +686,8 @@ def test_get_orgs_and_services_only_returns_active(admin_request, sample_user): 'services': [ { 'name': service1.name, - 'id': str(service1.id) + 'id': str(service1.id), + 'restricted': False, } ] } @@ -691,7 +695,8 @@ def test_get_orgs_and_services_only_returns_active(admin_request, sample_user): 'services_without_organisations': [ { 'name': service4.name, - 'id': str(service4.id) + 'id': str(service4.id), + 'restricted': False, } ] } @@ -727,7 +732,8 @@ def test_get_orgs_and_services_only_shows_users_orgs_and_services(admin_request, 'services_without_organisations': [ { 'name': service1.name, - 'id': str(service1.id) + 'id': str(service1.id), + 'restricted': False, } ] }