2
Tests for Django's bundled context processors.
5
from django.conf import settings
6
from django.test import TestCase
9
class RequestContextProcessorTests(TestCase):
11
Tests for the ``django.core.context_processors.request`` processor.
14
urls = 'regressiontests.context_processors.urls'
16
def test_request_attributes(self):
18
Test that the request object is available in the template and that its
19
attributes can't be overridden by GET and POST parameters (#3828).
21
url = '/request_attrs/'
22
# We should have the request object in the template.
23
response = self.client.get(url)
24
self.assertContains(response, 'Have request')
26
response = self.client.get(url)
27
self.assertContains(response, 'Not secure')
28
response = self.client.get(url, {'is_secure': 'blah'})
29
self.assertContains(response, 'Not secure')
30
response = self.client.post(url, {'is_secure': 'blah'})
31
self.assertContains(response, 'Not secure')
33
response = self.client.get(url)
34
self.assertContains(response, url)
35
response = self.client.get(url, {'path': '/blah/'})
36
self.assertContains(response, url)
37
response = self.client.post(url, {'path': '/blah/'})
38
self.assertContains(response, url)