Source

CherryPy / cherrypy / test / test_cache_filter.py

Full commit
Robert Brewer 22c69e1 
Robert Brewer 0616050 

Robert Brewer 22c69e1 
Robert Brewer 0616050 

Robert Brewer 22c69e1 
Robert Brewer 0616050 

Robert Brewer 22c69e1 

Robert Brewer 0616050 


Robert Brewer 22c69e1 

Robert Brewer 0616050 







Robert Brewer 09e3214 
Robert Brewer 0616050 


Robert Brewer 09e3214 
Robert Brewer 81515bb 
Robert Brewer 0616050 

Robert Brewer 42e583c 
import cherrypy
import time


class Root:
    def __init__(self):
        cherrypy.counter = 0
    
    def index(self):
        counter = cherrypy.counter + 1
        cherrypy.counter = counter
        return "visit #%s" % counter
    index.exposed = True

cherrypy.root = Root()
cherrypy.config.update({
        'server.logToScreen': False,
        'server.environment': 'production',
        'cacheFilter.on': True,
})


import helper

class CacheFilterTest(helper.CPWebCase):
    
    def testCaching(self):
        for trial in xrange(2):
            self.getPage("/")
            self.assertBody('visit #1')

if __name__ == '__main__':
    helper.testmain()