Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 2466

Show
Ignore:
Timestamp:
06/25/09 16:53:55
Author:
fumanchu
Message:

New redirect to parent URI test.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/test/test_objectmapping.py

    r2323 r2466  
    4040            return cherrypy.request.config.get("user") 
    4141        confvalue.exposed = True 
     42         
     43        def redirect_via_url(self, path): 
     44            raise cherrypy.HTTPRedirect(cherrypy.url(path)) 
     45        redirect_via_url.exposed = True 
    4246     
    4347    def mapped_func(self, ID=None): 
     
    260264        self.assertBody("bar") 
    261265     
     266    def test_redir_using_url(self): 
     267        for url in script_names: 
     268            prefix = self.script_name = url 
     269             
     270            # Test the absolute path to the parent (leading slash) 
     271            self.getPage('/redirect_via_url?path=./') 
     272            self.assertStatus(('302 Found', '303 See Other')) 
     273            self.assertHeader('Location', '%s/' % self.base()) 
     274             
     275            # Test the relative path to the parent (no leading slash) 
     276            self.getPage('/redirect_via_url?path=./') 
     277            self.assertStatus(('302 Found', '303 See Other')) 
     278            self.assertHeader('Location', '%s/' % self.base()) 
     279             
     280            # Test the absolute path to the parent (leading slash) 
     281            self.getPage('/redirect_via_url/?path=./') 
     282            self.assertStatus(('302 Found', '303 See Other')) 
     283            self.assertHeader('Location', '%s/' % self.base()) 
     284             
     285            # Test the relative path to the parent (no leading slash) 
     286            self.getPage('/redirect_via_url/?path=./') 
     287            self.assertStatus(('302 Found', '303 See Other')) 
     288            self.assertHeader('Location', '%s/' % self.base()) 
     289     
    262290    def testPositionalParams(self): 
    263291        self.getPage("/dir1/dir2/posparam/18/24/hut/hike") 

Hosted by WebFaction

Log in as guest/cpguest to create tickets