summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_views.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-05-15 17:28:00 +0200
committerClaude Paroz <claude@2xlibre.net>2016-06-24 10:45:13 +0200
commit78963495d0caadb77eb97ccf319ef0ba3b204fb5 (patch)
tree52162432f13b92b85b6188a6415887cfc06c5701 /tests/auth_tests/test_views.py
parent742ea51413b3aab07c6afbfd1d52c1908ffcb510 (diff)
Refs #17209 -- Added LoginView and LogoutView class-based views
Thanks Tim Graham for the review.
Diffstat (limited to 'tests/auth_tests/test_views.py')
-rw-r--r--tests/auth_tests/test_views.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
index 5b4b877c47..bd01c67d70 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -15,7 +15,7 @@ from django.contrib.auth.forms import (
AuthenticationForm, PasswordChangeForm, SetPasswordForm,
)
from django.contrib.auth.models import User
-from django.contrib.auth.views import login as login_view, redirect_to_login
+from django.contrib.auth.views import LoginView, redirect_to_login
from django.contrib.sessions.middleware import SessionMiddleware
from django.contrib.sites.requests import RequestSite
from django.core import mail
@@ -553,10 +553,10 @@ class LoginTest(AuthViewsTestCase):
# Do a GET to establish a CSRF token
# TestClient isn't used here as we're testing middleware, essentially.
req = HttpRequest()
- CsrfViewMiddleware().process_view(req, login_view, (), {})
+ CsrfViewMiddleware().process_view(req, LoginView.as_view(), (), {})
# get_token() triggers CSRF token inclusion in the response
get_token(req)
- resp = login_view(req)
+ resp = LoginView.as_view()(req)
resp2 = CsrfViewMiddleware().process_response(req, resp)
csrf_cookie = resp2.cookies.get(settings.CSRF_COOKIE_NAME, None)
token1 = csrf_cookie.coded_value
@@ -569,10 +569,10 @@ class LoginTest(AuthViewsTestCase):
# Use POST request to log in
SessionMiddleware().process_request(req)
- CsrfViewMiddleware().process_view(req, login_view, (), {})
+ CsrfViewMiddleware().process_view(req, LoginView.as_view(), (), {})
req.META["SERVER_NAME"] = "testserver" # Required to have redirect work in login view
req.META["SERVER_PORT"] = 80
- resp = login_view(req)
+ resp = LoginView.as_view()(req)
resp2 = CsrfViewMiddleware().process_response(req, resp)
csrf_cookie = resp2.cookies.get(settings.CSRF_COOKIE_NAME, None)
token2 = csrf_cookie.coded_value