~ubuntu-branches/ubuntu/jaunty/python-django/jaunty-backports

« back to all changes in this revision

Viewing changes to tests/regressiontests/context_processors/tests.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2008-11-15 19:15:33 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20081115191533-xbt1ut2xf4fvwtvc
Tags: 1.0.1-0ubuntu1
* New upstream release:
  - Bug fixes.

* The tests/ sub-directory appaers to have been dropped upstream, so pull
  our patch to workaround the tests and modify the rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""
2
 
Tests for Django's bundled context processors.
3
 
"""
4
 
 
5
 
from django.conf import settings
6
 
from django.test import TestCase
7
 
 
8
 
 
9
 
class RequestContextProcessorTests(TestCase):
10
 
    """
11
 
    Tests for the ``django.core.context_processors.request`` processor.
12
 
    """
13
 
 
14
 
    urls = 'regressiontests.context_processors.urls'
15
 
 
16
 
    def test_request_attributes(self):
17
 
        """
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).
20
 
        """
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')
25
 
        # Test is_secure.
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')
32
 
        # Test path.
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)