aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/users/tests/test_views.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-05-27 17:07:18 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-05-27 17:07:18 +0100
commitd2ae7679000b6299c408d34f88a1c5c66755288c (patch)
treeb275e48697be74ed15e8d43bab2dafa88ae21137 /ctrack/users/tests/test_views.py
parentfa674ad70439cea0de962b87e5ac4c4dc0fa16f7 (diff)
need to fix permission denied 403 tests
Diffstat (limited to '')
-rw-r--r--ctrack/users/tests/test_views.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/ctrack/users/tests/test_views.py b/ctrack/users/tests/test_views.py
index ae7fbd7..6cbe9b6 100644
--- a/ctrack/users/tests/test_views.py
+++ b/ctrack/users/tests/test_views.py
@@ -2,6 +2,7 @@ import pytest
from django.test import RequestFactory
from ctrack.core.views import home_page
+from ctrack.organisations.views import OrganisationListView
from ctrack.users.models import User
from ctrack.users.views import UserDetailView, UserRedirectView, UserUpdateView
@@ -145,15 +146,13 @@ def test_stakeholder_user_is_not_staff(django_user_model, stakeholder):
def test_user_received_persmission_denied_when_accessing_disallowed_page(
- django_user_model, request_factory, stakeholder
+ django_user_model, request_factory, stakeholder,
):
user = django_user_model.objects.create_user(username="toss", password="knob")
user.stakeholder = stakeholder
user.save()
- assert user.has_perm("ctrack.organisations.view_organisation") is True
- user.user_permissions.clear()
- assert user.has_perm("ctrack.organisations.view_organisation") is False
request = request_factory.get("/organisations")
request.user = user
- response = home_page(request)
+ assert request.user.is_staff is False
+ response = OrganisationListView.as_view()(request)
assert response.status_code == 403