mirror of https://github.com/django/django.git
Fixed auth context processor tests, which were not running at all previously.
It seems they were accidentally disabled following being moved from regressiontests in [15990] git-svn-id: http://code.djangoproject.com/svn/django/trunk@16304 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
93e9d91501
commit
4531767700
|
@ -2,6 +2,7 @@ from django.contrib.auth.tests.auth_backends import (BackendTest,
|
||||||
RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest,
|
RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest,
|
||||||
NoBackendsTest, InActiveUserBackendTest, NoInActiveUserBackendTest)
|
NoBackendsTest, InActiveUserBackendTest, NoInActiveUserBackendTest)
|
||||||
from django.contrib.auth.tests.basic import BasicTestCase
|
from django.contrib.auth.tests.basic import BasicTestCase
|
||||||
|
from django.contrib.auth.tests.context_processors import AuthContextProcessorTests
|
||||||
from django.contrib.auth.tests.decorators import LoginRequiredTestCase
|
from django.contrib.auth.tests.decorators import LoginRequiredTestCase
|
||||||
from django.contrib.auth.tests.forms import (UserCreationFormTest,
|
from django.contrib.auth.tests.forms import (UserCreationFormTest,
|
||||||
AuthenticationFormTest, SetPasswordFormTest, PasswordChangeFormTest,
|
AuthenticationFormTest, SetPasswordFormTest, PasswordChangeFormTest,
|
||||||
|
|
|
@ -1,16 +1,27 @@
|
||||||
# from django.conf import settings
|
import os
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib.auth import authenticate
|
from django.contrib.auth import authenticate
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
# from django.template import Template
|
|
||||||
|
|
||||||
class AuthContextProcessorTests(TestCase):
|
class AuthContextProcessorTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests for the ``django.contrib.auth.context_processors.auth`` processor
|
Tests for the ``django.contrib.auth.context_processors.auth`` processor
|
||||||
"""
|
"""
|
||||||
urls = 'regressiontests.context_processors.urls'
|
urls = 'django.contrib.auth.tests.urls'
|
||||||
fixtures = ['context-processors-users.xml']
|
fixtures = ['context-processors-users.xml']
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
|
||||||
|
settings.TEMPLATE_DIRS = (
|
||||||
|
os.path.join(os.path.dirname(__file__), 'templates'),
|
||||||
|
)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
|
||||||
|
|
||||||
def test_session_not_accessed(self):
|
def test_session_not_accessed(self):
|
||||||
"""
|
"""
|
||||||
Tests that the session is not accessed simply by including
|
Tests that the session is not accessed simply by including
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
from django.conf.urls.defaults import patterns, url
|
from django.conf.urls.defaults import patterns, url
|
||||||
|
from django.contrib.auth import context_processors
|
||||||
from django.contrib.auth.urls import urlpatterns
|
from django.contrib.auth.urls import urlpatterns
|
||||||
from django.contrib.auth.views import password_reset
|
from django.contrib.auth.views import password_reset
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.contrib.messages.api import info
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
from django.shortcuts import render_to_response
|
||||||
from django.template import Template, RequestContext
|
from django.template import Template, RequestContext
|
||||||
from django.views.decorators.cache import never_cache
|
from django.views.decorators.cache import never_cache
|
||||||
|
|
||||||
|
@ -35,7 +38,7 @@ def auth_processor_perms(request):
|
||||||
RequestContext(request, {}, processors=[context_processors.auth]))
|
RequestContext(request, {}, processors=[context_processors.auth]))
|
||||||
|
|
||||||
def auth_processor_messages(request):
|
def auth_processor_messages(request):
|
||||||
request.user.message_set.create(message="Message 1")
|
info(request, "Message 1")
|
||||||
return render_to_response('context_processors/auth_attrs_messages.html',
|
return render_to_response('context_processors/auth_attrs_messages.html',
|
||||||
RequestContext(request, {}, processors=[context_processors.auth]))
|
RequestContext(request, {}, processors=[context_processors.auth]))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue