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

Changeset 1992

Show
Ignore:
Timestamp:
06/28/08 13:48:11
Author:
fumanchu
Message:

Test for #829 (@tools.response.headers doesn't appear to work with response.stream True).

Files:

Legend:

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

    r1991 r1992  
    11"""Test module for Python 2.5-specific syntax, like the @-decorator syntax.""" 
    22 
    3 from cherrypy import expose 
     3from cherrypy import expose, tools 
    44 
    55 
     
    2727 
    2828 
     29class ToolExamples(object): 
     30     
     31    @expose 
     32    @tools.response_headers(headers=[('Content-Type', 'application/data')]) 
     33    def blah(self): 
     34        yield "blah" 
     35    # This is here to demonstrate that _cp_config = {...} overwrites 
     36    # the _cp_config attribute added by the Tool decorator. You have 
     37    # to write _cp_config[k] = v or _cp_config.update(...) instead. 
     38    blah._cp_config['response.stream'] = True 
     39 
     40 
  • trunk/cherrypy/test/test_core.py

    r1990 r1992  
    950950     
    951951    def testCookies(self): 
    952         import sys 
    953952        if sys.version_info >= (2, 5): 
    954953            self.getPage("/cookies/single?name=First", 
  • trunk/cherrypy/test/test_tools.py

    r1978 r1992  
    11"""Test the various means of instantiating and invoking tools.""" 
    22 
    3 import gzip, StringIO 
     3import gzip 
     4import StringIO 
     5import sys 
    46import time 
    57timeout = 0.2 
     
    229231    app = cherrypy.tree.mount(root, config=conf) 
    230232    app.request_class.namespaces['myauth'] = myauthtools 
     233 
     234    if sys.version_info >= (2, 5): 
     235        from cherrypy.test import py25 
     236        root.tooldecs = py25.ToolExamples() 
    231237 
    232238 
     
    363369        self.getPage("/tarfile") 
    364370        self.assertBody("I am a tarfile") 
     371     
     372    def testToolWithConfig(self): 
     373        if not sys.version_info >= (2, 5): 
     374            print "skipped (Python 2.5+ only)", 
     375            return 
     376         
     377        self.getPage('/tooldecs/blah') 
     378        self.assertHeader('Content-Type', 'application/data') 
    365379 
    366380 

Hosted by WebFaction

Log in as guest/cpguest to create tickets