diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-21 16:09:05 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-21 16:09:05 +0100 |
commit | cbddf7c7fad44f62b1cf057158bcf9e53f8e1bb4 (patch) | |
tree | ed3eb1783d7a0a73561a081e23cb5839ecb0bffb /ctrack/organisations/tests | |
parent | cadbccdf61525c67107ab0f1b1206f4d5e07861a (diff) |
now have an OES-only organisation page
Diffstat (limited to '')
-rw-r--r-- | ctrack/organisations/tests/test_views.py | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/ctrack/organisations/tests/test_views.py b/ctrack/organisations/tests/test_views.py index e1b31fb..c939894 100644 --- a/ctrack/organisations/tests/test_views.py +++ b/ctrack/organisations/tests/test_views.py @@ -9,7 +9,7 @@ from ctrack.organisations.tests.factories import ( OrganisationFactory, SingleDateTimeEventFactory, ) -from ctrack.organisations.views import IncidentReportCreateView, OrganisationDetailView +from ctrack.organisations.views import IncidentReportCreateView, OrganisationDetailView, oes_list from ..utils import filter_private_events from ..views import OrganisationListView @@ -49,7 +49,6 @@ def test_meetings_in_organisation_detail_view(user, client, org_with_people): assert "First Meeting" in html - def test_private_event_filter(user, org_with_people): """ In this test we are creating five events, using two different users. @@ -206,6 +205,29 @@ def test_organisation_list_view(): assert len(response.context_data["organisation_list"]) == 3 +def test_oes_list_view(): + OrganisationFactory.create(oes=True) + OrganisationFactory.create(oes=True) + OrganisationFactory.create(oes=True) + + factory = RequestFactory() + user = get_user_model().objects.create_user( + username="testy", email="testy@test.com", password="test1020" + ) + # This user needs permission to acccess the list view + org_list_permission = Permission.objects.get(name="Can view organisation") + assert user.user_permissions.count() == 0 + user.user_permissions.add(org_list_permission) + assert user.has_perm("organisations.view_organisation") + user.save() + request = factory.get("/organisations/oes") + request.user = user + response = oes_list(request) + assert response.status_code == 200 + html = response.content.decode("utf-8") + assert "OES" in html + + def test_only_member_of_cct_user_group_can_view_org_list(): OrganisationFactory.create() OrganisationFactory.create() |