Ñò ˆ_‚Jc@sˆdZddkZddklZddklZddklZddkl Z ddk l Z ddk l Z dd klZdd klZdd klZlZlZlZd „Zd „ZhZddd„ƒYZeƒZddkZeei_defd„ƒYZ defd„ƒYZ!defd„ƒYZ"defd„ƒYZ#defd„ƒYZ$defd„ƒYZ%dS(sŒ Test cases for Pylons caching. See: http://wiki.pylonshq.com/display/pylonsdocs/Caching+in+Templates+and+Controllers For more details. iÿÿÿÿN(t TGController(texpose(t beaker_cache(t etag_cache(tcache(tMapper(tRoutesMiddleware(tHTTPNotModified(tTestWSGIControllertmake_apptsetup_session_dirtteardown_session_dircCs tƒdS(N(R (((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pytsetupscCs tƒdS(N(R (((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pytteardownstMockTimecBs&eZdZdZd„Zd„ZRS(su A very simple class to mock the time module. This lets us slide time around to fake expiry in beaker.container. icCs|iS(N(t mock_time(tself((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyttime'scCs ||_dS(N(R(Rtv((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pytset_time*s(t__name__t __module__t__doc__RRR(((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyR s tSimpleCachingControllercBs;eZdZeƒd„ƒZd„Zeƒd„ƒZRS(sÉ Pylons supports a mechanism for arbitrary caches that can be allocated within controllers. Each cache value has a creation function associated with it that is called to retrieve it's results. c s@tidƒ}|idˆd‡fd†ddddƒ}|S( NsBasicTGController.indextkeyt createfunccsdˆS(s cached %s(((ta(s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyt;sttypetmemoryt expiretimei(Rt get_cachet get_value(RRtctx((Rs9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pytsimple7s  cCs dtdS(Ns cached %stexpiry(tmockdb(R((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyR@sc CsD|td(((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyR<‡stTestEtagCachingcBs)eZdZd„Zd„Zd„ZRS(sM A simple mechanism is provided to set the etag header for returned results. cOs&ti|||Žttƒ|_dS(N(RR(R R<R*(RR+R,((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyR(’scCsB|iiddhdd6ƒ}|iiddhdd6ƒ}dS(sB Test that the etag in the response headers is the one we expect. s /etagged/R-R.R=R/N(R*R1(RR2((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyt test_etags–scCs8|iiddhdd6dhdd6ƒ}|iGHdS(Ns /etagged/R-R.R=theaderss if-none-match(R*R1t status_int(RR2((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyttest_304s,(RRRR(R@RC(((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyR?Žs  ((&Rttgttg.controllersRt tg.decoratorsRtpylons.decorators.cacheRtpylons.controllers.utilRtpylonsRtroutesRtroutes.middlewareRt webob.excRt tg.tests.baseRR R R R R R%RR6tbeaker.containertbeakert containerRRR'R8R:R<R?(((s9/usr/lib/python2.6/site-packages/tg/tests/test_caching.pyt s. "