organisation dashboard page

This commit is contained in:
chrisw
2018-02-14 13:08:44 +00:00
parent c1e3658a8f
commit dd2231056d
11 changed files with 144 additions and 47 deletions

View File

@@ -46,9 +46,12 @@ def test_view_organisation_shows_the_correct_organisation(
mocker.patch(
'app.organisations_client.get_organisation', return_value=org
)
mocker.patch(
'app.organisations_client.get_organisation_services', return_value=[]
)
response = logged_in_platform_admin_client.get(
url_for('.view_organisation', org_id=fake_uuid)
url_for('.organisation_dashboard', org_id=fake_uuid)
)
assert response.status_code == 200
@@ -122,3 +125,29 @@ def test_update_organisation(
org_id=fake_uuid,
name=org['name']
)
def test_organisation_services_show(
logged_in_platform_admin_client,
mock_get_organisation,
mock_get_organisation_services,
mocker,
fake_uuid,
):
response = logged_in_platform_admin_client.get(
url_for('.organisation_dashboard', org_id=mock_get_organisation['id']),
)
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert len(page.select('.browse-list-item')) == 3
for i in range(0, 3):
service_name = mock_get_organisation_services(mock_get_organisation['id'])[i]['name']
service_id = mock_get_organisation_services(mock_get_organisation['id'])[i]['id']
assert normalize_spaces(page.select('.browse-list-item')[i].text) == service_name
assert normalize_spaces(
page.select('.browse-list-item a')[i]['href']
) == '/services/{}/dashboard'.format(service_id)

View File

@@ -2690,3 +2690,18 @@ def mock_update_service_organisation(mocker):
'app.organisations_client.update_service_organisation',
side_effect=_update_service_organisation
)
@pytest.fixture(scope='function')
def mock_get_organisation_services(mocker):
def _get_organisation_services(organisation_id):
return [
service_json('12345', 'service one'),
service_json('67890', 'service two'),
service_json('09876', 'service three')
]
return mocker.patch(
'app.organisations_client.get_organisation_services',
side_effect=_get_organisation_services
)