Add count of live services to organisations

This makes it clear that these are something different to the trial
mode services, in that they are a container of multiple things.
This commit is contained in:
Chris Hill-Scott
2019-06-07 09:58:09 +01:00
parent 722d1f0af4
commit 3be1f79cf9
4 changed files with 51 additions and 12 deletions

View File

@@ -51,7 +51,9 @@ def mock_get_orgs_and_services(mocker):
def test_choose_account_should_show_choose_accounts_page(
client_request,
mock_get_orgs_and_services
mock_get_orgs_and_services,
mock_get_organisation,
mock_get_organisation_services,
):
resp = client_request.get('main.choose_account')
page = resp.find('div', {'id': 'content'}).main
@@ -62,19 +64,25 @@ def test_choose_account_should_show_choose_accounts_page(
assert len(outer_list_items) == 6
# first org
assert outer_list_items[0].a.text == 'org_1'
assert outer_list_items[0].a.text == 'Org 1'
assert outer_list_items[0].a['href'] == url_for('.organisation_dashboard', org_id='o1')
assert not outer_list_items[0].ul
assert normalize_spaces(outer_list_items[0].select_one('.browse-list-hint').text) == (
'1 live service'
)
# second org
assert outer_list_items[1].a.text == 'org_2'
assert outer_list_items[1].a.text == 'Org 2'
assert outer_list_items[1].a['href'] == url_for('.organisation_dashboard', org_id='o2')
assert not outer_list_items[2].ul
assert normalize_spaces(outer_list_items[1].select_one('.browse-list-hint').text) == (
'2 live services'
)
# third org
assert outer_list_items[2].a.text == 'org_3'
assert outer_list_items[2].a.text == 'Org 3'
assert outer_list_items[2].a['href'] == url_for('.organisation_dashboard', org_id='o3')
assert not outer_list_items[2].ul # org 3 has no services
assert normalize_spaces(outer_list_items[2].select_one('.browse-list-hint').text) == (
'0 live services'
)
# orphaned services
assert outer_list_items[3].a.text == 'service_1'
@@ -87,7 +95,9 @@ def test_choose_account_should_show_choose_accounts_page(
def test_choose_account_should_show_choose_accounts_page_if_no_services(
client_request,
mock_get_orgs_and_services
mock_get_orgs_and_services,
mock_get_organisation,
mock_get_organisation_services,
):
mock_get_orgs_and_services.return_value = {
'organisations': [],
@@ -122,7 +132,9 @@ def test_choose_account_should_should_organisations_link_for_platform_admin(
def test_choose_account_should_show_back_to_service_link(
client_request,
mock_get_orgs_and_services
mock_get_orgs_and_services,
mock_get_organisation,
mock_get_organisation_services,
):
resp = client_request.get('main.choose_account')
@@ -136,7 +148,9 @@ def test_choose_account_should_show_back_to_service_link(
def test_choose_account_should_not_show_back_to_service_link_if_no_service_in_session(
client,
client_request,
mock_get_orgs_and_services
mock_get_orgs_and_services,
mock_get_organisation,
mock_get_organisation_services,
):
with client.session_transaction() as session:
session['service_id'] = None
@@ -166,6 +180,8 @@ def test_choose_account_should_not_show_back_to_service_link_if_service_archived
client_request,
service_one,
mock_get_orgs_and_services,
mock_get_organisation,
mock_get_organisation_services,
active,
):
service_one['active'] = active