mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Rename model to AllOrganisations
This makes it clearer that this model collection isn’t the organisations for a user or a service or some other entity, like most model collections are. It will also lets us make a separate Organisations model, without the name conflicting.
This commit is contained in:
@@ -3,7 +3,7 @@ from flask_login import current_user
|
|||||||
|
|
||||||
from app import status_api_client
|
from app import status_api_client
|
||||||
from app.main import main
|
from app.main import main
|
||||||
from app.models.organisation import Organisations
|
from app.models.organisation import AllOrganisations
|
||||||
from app.utils import PermanentRedirect
|
from app.utils import PermanentRedirect
|
||||||
from app.utils.user import user_is_logged_in
|
from app.utils.user import user_is_logged_in
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ def choose_account():
|
|||||||
org_count, live_service_count = None, None
|
org_count, live_service_count = None, None
|
||||||
if current_user.platform_admin:
|
if current_user.platform_admin:
|
||||||
org_count, live_service_count = (
|
org_count, live_service_count = (
|
||||||
len(Organisations()),
|
len(AllOrganisations()),
|
||||||
status_api_client.get_count_of_live_services_and_organisations()['services'],
|
status_api_client.get_count_of_live_services_and_organisations()['services'],
|
||||||
)
|
)
|
||||||
return render_template(
|
return render_template(
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ from app.main.views.dashboard import (
|
|||||||
requested_and_current_financial_year,
|
requested_and_current_financial_year,
|
||||||
)
|
)
|
||||||
from app.main.views.service_settings import get_branding_as_value_and_label
|
from app.main.views.service_settings import get_branding_as_value_and_label
|
||||||
from app.models.organisation import Organisation, Organisations
|
from app.models.organisation import AllOrganisations, Organisation
|
||||||
from app.models.user import InvitedOrgUser, User
|
from app.models.user import InvitedOrgUser, User
|
||||||
from app.utils.user import user_has_permissions, user_is_platform_admin
|
from app.utils.user import user_has_permissions, user_is_platform_admin
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ from app.utils.user import user_has_permissions, user_is_platform_admin
|
|||||||
def organisations():
|
def organisations():
|
||||||
return render_template(
|
return render_template(
|
||||||
'views/organisations/index.html',
|
'views/organisations/index.html',
|
||||||
organisations=Organisations(),
|
organisations=AllOrganisations(),
|
||||||
search_form=SearchByNameForm(),
|
search_form=SearchByNameForm(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ def add_organisation_from_nhs_local_service(service_id):
|
|||||||
|
|
||||||
form = AddNHSLocalOrganisationForm(organisation_choices=[
|
form = AddNHSLocalOrganisationForm(organisation_choices=[
|
||||||
(organisation.id, organisation.name)
|
(organisation.id, organisation.name)
|
||||||
for organisation in Organisations()
|
for organisation in AllOrganisations()
|
||||||
if organisation.organisation_type == Organisation.TYPE_NHS_LOCAL
|
if organisation.organisation_type == Organisation.TYPE_NHS_LOCAL
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -204,6 +204,6 @@ class Organisation(JSONModel):
|
|||||||
return organisations_client.get_services_and_usage(self.id, financial_year)
|
return organisations_client.get_services_and_usage(self.id, financial_year)
|
||||||
|
|
||||||
|
|
||||||
class Organisations(ModelList):
|
class AllOrganisations(ModelList):
|
||||||
client_method = organisations_client.get_organisations
|
client_method = organisations_client.get_organisations
|
||||||
model = Organisation
|
model = Organisation
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ def test_organisation_page_shows_all_organisations(
|
|||||||
]
|
]
|
||||||
|
|
||||||
get_organisations = mocker.patch(
|
get_organisations = mocker.patch(
|
||||||
'app.models.organisation.Organisations.client_method', return_value=orgs
|
'app.models.organisation.AllOrganisations.client_method', return_value=orgs
|
||||||
)
|
)
|
||||||
response = platform_admin_client.get(
|
response = platform_admin_client.get(
|
||||||
url_for('.organisations')
|
url_for('.organisations')
|
||||||
@@ -274,7 +274,7 @@ def test_nhs_local_can_create_own_organisations(
|
|||||||
):
|
):
|
||||||
mocker.patch('app.organisations_client.get_organisation', return_value=organisation)
|
mocker.patch('app.organisations_client.get_organisation', return_value=organisation)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'app.models.organisation.Organisations.client_method',
|
'app.models.organisation.AllOrganisations.client_method',
|
||||||
return_value=[
|
return_value=[
|
||||||
organisation_json('t1', 'Trust 1', organisation_type='nhs_local'),
|
organisation_json('t1', 'Trust 1', organisation_type='nhs_local'),
|
||||||
organisation_json('t2', 'Trust 2', organisation_type='nhs_local'),
|
organisation_json('t2', 'Trust 2', organisation_type='nhs_local'),
|
||||||
@@ -405,7 +405,7 @@ def test_nhs_local_assigns_to_selected_organisation(
|
|||||||
mock_update_service_organisation,
|
mock_update_service_organisation,
|
||||||
):
|
):
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'app.models.organisation.Organisations.client_method',
|
'app.models.organisation.AllOrganisations.client_method',
|
||||||
return_value=[
|
return_value=[
|
||||||
organisation_json(ORGANISATION_ID, 'Trust 1', organisation_type='nhs_local'),
|
organisation_json(ORGANISATION_ID, 'Trust 1', organisation_type='nhs_local'),
|
||||||
],
|
],
|
||||||
|
|||||||
+1
-1
@@ -3119,7 +3119,7 @@ def mock_get_organisations(mocker):
|
|||||||
]
|
]
|
||||||
|
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'app.models.organisation.Organisations.client_method',
|
'app.models.organisation.AllOrganisations.client_method',
|
||||||
side_effect=_get_organisations,
|
side_effect=_get_organisations,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user