From 54aa9bfe8a3815229b5b79f28a4fcc9e0e32fdbc Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Sun, 24 May 2020 16:35:44 +0100 Subject: working on test_profile_view_contains_organisation_information - FAILING --- ctrack/users/tests/test_views.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ctrack/users/tests') 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 -- cgit v1.2.3