Django

Code

Changeset 6991

Show
Ignore:
Timestamp:
01/02/08 20:14:29 (8 months ago)
Author:
gwilson
Message:

Middleware regression test fixes:

  • Added a models.py file so the tests run.
  • Reset settings.DEBUG to False at the end of the test_append_slash_no_redirect_on_POST_in_DEBUG test so it doesn't bleed over to other tests.
  • Removed unused import.
  • Minor docstring fixes.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/middleware/tests.py

    r6852 r6991  
    11# -*- coding: utf-8 -*- 
    22 
    3 import unittest 
    4  
    5 from django.test import TestCase  
     3from django.test import TestCase 
    64from django.http import HttpRequest 
    75from django.middleware.common import CommonMiddleware 
     
    2018    def test_append_slash_have_slash(self): 
    2119        """ 
    22         tests that urls with slashes go unmolested 
     20        Tests that URLs with slashes go unmolested. 
    2321        """ 
    2422        settings.APPEND_SLASH = True 
     
    2826    def test_append_slash_slashless_resource(self): 
    2927        """ 
    30         tests that matches to explicit slashless urls go unmolested 
     28        Tests that matches to explicit slashless URLs go unmolested. 
    3129        """ 
    3230        settings.APPEND_SLASH = True 
     
    3634    def test_append_slash_slashless_unknown(self): 
    3735        """ 
    38         tests that APPEND_SLASH doesn't redirect to unknown resources 
     36        Tests that APPEND_SLASH doesn't redirect to unknown resources. 
    3937        """ 
    4038        settings.APPEND_SLASH = True 
     
    4442    def test_append_slash_redirect(self): 
    4543        """ 
    46         tests that APPEND_SLASH redirects slashless urls to a valid pattern 
     44        Tests that APPEND_SLASH redirects slashless URLs to a valid pattern. 
    4745        """ 
    4846        settings.APPEND_SLASH = True 
     
    5452    def test_append_slash_no_redirect_on_POST_in_DEBUG(self): 
    5553        """ 
    56         tests that while in debug mode, an exception is raised with a warning 
    57         when a failed attempt is made to POST to an url which would normally be 
    58         redirected to a slashed version 
     54        Tests that while in debug mode, an exception is raised with a warning 
     55        when a failed attempt is made to POST to an URL which would normally be 
     56        redirected to a slashed version. 
    5957        """ 
    6058        settings.APPEND_SLASH = True 
     
    7068        except RuntimeError, e: 
    7169            self.assertTrue('end in a slash' in str(e)) 
     70        settings.DEBUG = False 
    7271 
    7372    def test_append_slash_disabled(self): 
    7473        """ 
    75         tests disabling append slash functionality 
     74        Tests disabling append slash functionality. 
    7675        """ 
    7776        settings.APPEND_SLASH = False 
     
    8180    def test_append_slash_quoted(self): 
    8281        """ 
    83         tests that urls which require quoting are redirected to their slash 
    84         version ok 
     82        Tests that URLs which require quoting are redirected to their slash 
     83        version ok. 
    8584        """ 
    8685        settings.APPEND_SLASH = True 
     
    9190            r['Location'], 
    9291            'http://testserver/middleware/needsquoting%23/') 
    93