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

Changeset 1297

Show
Ignore:
Timestamp:
08/29/06 13:53:37
Author:
fumanchu
Message:

New test for default handler when using MethodDispatcher?.

Files:

Legend:

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

    r1278 r1297  
    103103        default.exposed = True 
    104104     
     105    # MethodDispatcher code 
    105106    class ByMethod: 
    106107        exposed = True 
     
    114115        def POST(self, thing): 
    115116            self.things.append(thing) 
     117     
     118    class Collection: 
     119        default = ByMethod('a', 'bit') 
    116120     
    117121    Root.exposing = Exposing() 
     
    123127    Root.defnoindex = DefNoIndex() 
    124128    Root.bymethod = ByMethod('another') 
     129    Root.collection = Collection() 
    125130     
    126131    for url in script_names: 
     
    128133        conf = {'/': {'user': (url or "/").split("/")[-2]}, 
    129134                '/bymethod': {'request.dispatch': d}, 
     135                '/collection': {'request.dispatch': d}, 
    130136                } 
    131137        cherrypy.tree.mount(Root(), url, conf) 
     
    276282        self.assertErrorPage(405) 
    277283        self.assertHeader('Allow', 'GET, HEAD, POST') 
     284         
     285        # Test default with posparams 
     286        self.getPage("/collection/silly", method="POST") 
     287        self.getPage("/collection", method="GET") 
     288        self.assertBody("['a', 'bit', 'silly']") 
    278289 
    279290 

Hosted by WebFaction

Log in as guest/cpguest to create tickets