aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrack/users/tests/test_views.py16
-rw-r--r--ctrack/users/views.py4
2 files changed, 17 insertions, 3 deletions
diff --git a/ctrack/users/tests/test_views.py b/ctrack/users/tests/test_views.py
index 3e7fbf7..33ab238 100644
--- a/ctrack/users/tests/test_views.py
+++ b/ctrack/users/tests/test_views.py
@@ -2,7 +2,7 @@ import pytest
from django.test import RequestFactory
from ctrack.users.models import User
-from ctrack.users.views import UserRedirectView, UserUpdateView
+from ctrack.users.views import UserDetailView, UserRedirectView, UserUpdateView
pytestmark = pytest.mark.django_db
@@ -44,3 +44,17 @@ class TestUserRedirectView:
view.request = request
assert view.get_redirect_url() == f"/users/{user.username}/"
+
+
+def test_profile_view_contains_organisation_information(user: User):
+ """url: users/username
+ This is where users are redirected to when they log in and where I want to capture
+ information about the user - particularly if they are an OES user.
+ """
+ factory = RequestFactory()
+ request = factory.get(f"/users/{user.username}")
+ # we have to do the following to simulate logged-in user
+ # Django Advanced Testing Topics
+ request.user = user
+ response = UserDetailView.as_view()(request)
+ assert response.status_code == 300
diff --git a/ctrack/users/views.py b/ctrack/users/views.py
index 9cf69e9..a292191 100644
--- a/ctrack/users/views.py
+++ b/ctrack/users/views.py
@@ -1,9 +1,9 @@
+from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
-from django.views.generic import DetailView, RedirectView, UpdateView
-from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
+from django.views.generic import DetailView, RedirectView, UpdateView
User = get_user_model()