Ticket #16366: fix_auth_context_processor_tests.diff
File fix_auth_context_processor_tests.diff, 1.8 KB (added by , 13 years ago) |
---|
-
django/contrib/auth/tests/urls.py
3 3 from django.contrib.auth.urls import urlpatterns 4 4 from django.contrib.auth.views import password_reset 5 5 from django.contrib.auth.decorators import login_required 6 from django.contrib.auth.middleware import AuthenticationMiddleware 6 7 from django.contrib.messages.api import info 7 8 from django.http import HttpResponse 8 9 from django.shortcuts import render_to_response … … 17 18 return HttpResponse(t.render(c)) 18 19 19 20 def auth_processor_no_attr_access(request): 21 # Make sure to reset session and request.user before test 22 request.session.accessed = False 23 if hasattr(request, '_cached_user'): 24 del request._cached_user 25 auth_middleware = AuthenticationMiddleware() 26 auth_middleware.process_request(request) 27 20 28 r1 = render_to_response('context_processors/auth_attrs_no_access.html', 21 29 RequestContext(request, {}, processors=[context_processors.auth])) 22 30 # *After* rendering, we check whether the session was accessed … … 24 32 {'session_accessed':request.session.accessed}) 25 33 26 34 def auth_processor_attr_access(request): 35 # Make sure to reset session and request.user before test 36 request.session.accessed = False 37 if hasattr(request, '_cached_user'): 38 del request._cached_user 39 auth_middleware = AuthenticationMiddleware() 40 auth_middleware.process_request(request) 41 27 42 r1 = render_to_response('context_processors/auth_attrs_access.html', 28 43 RequestContext(request, {}, processors=[context_processors.auth])) 29 44 return render_to_response('context_processors/auth_attrs_test_access.html',