Ticket #25839: test_25839.py

File test_25839.py, 685 bytes (added by Tim Graham, 9 years ago)
Line 
1from django.test import TestCase, override_settings, RequestFactory
2from django.template import RequestContext
3
4
5def test_processor(request):
6 return {'processors': 'yes'}
7test_processor_name = 'template_tests.test_response.test_processor'
8
9
10@override_settings(
11 TEMPLATE_CONTEXT_PROCESSORS=[test_processor_name],
12 TEMPLATES=[{
13 'BACKEND': 'django.template.backends.django.DjangoTemplates',
14 'OPTIONS': {
15 'context_processors': [test_processor_name],
16 },
17}])
18class Test(TestCase):
19 def test_context_processor(self):
20 request = RequestFactory().get('/')
21 context = RequestContext(request)
22 self.assertEqual(context['processors'], 'yes')
Back to Top