Пример #1
0
 def setUp(self):
     TestWSGIController.setUp(self)
     app = ControllerWrap(ProtectedController)
     app = SetupCacheGlobal(app, self.environ, setup_session=True)
     app = SessionMiddleware(app, {}, data_dir=session_dir)
     app = RegistryManager(app)
     self.app = TestApp(app)
Пример #2
0
 def __init__(self, *args, **kargs):
     TestWSGIController.__init__(self, *args, **kargs)
     self.baseenviron = {}
     app = ControllerWrap(BasicWSGIController)
     app = self.sap = SetupCacheGlobal(app, self.baseenviron)
     app = RegistryManager(app)
     self.app = TestApp(app)
Пример #3
0
 def __init__(self, *args, **kargs):
     TestWSGIController.__init__(self, *args, **kargs)
     self.baseenviron = {}
     self.baseenviron['pylons.routes_dict'] = {}
     app = ControllerWrap(BaseXMLRPCController)
     app = self.sap = SetupCacheGlobal(app, self.baseenviron)
     app = RegistryManager(app)
     self.app = TestApp(app)
Пример #4
0
 def setUp(self):
     TestWSGIController.setUp(self)
     from routes import Mapper
     map = Mapper()
     map.connect('/:action/:id')
     map.connect('/:controller/:action/:id')
     app = ControllerWrap(HttpsController)
     app = SetupCacheGlobal(app, self.environ, setup_cache=False)
     app = RoutesMiddleware(app, map)
     app = RegistryManager(app)
     self.app = TestApp(app)
Пример #5
0
        pylons.response.headers['Content-Type'] = 'text/plain'
        pylons.response.headers['x-powered-by'] = 'pylons'
        return "Hello folks, time is %s" % time.time()

    test_header_cache = beaker_cache()(test_header_cache)


cache_dir = os.path.join(data_dir, 'cache')

try:
    shutil.rmtree(cache_dir)
except:
    pass

environ = {}
app = ControllerWrap(CacheController)
app = sap = SetupCacheGlobal(app, environ, setup_cache=True)
app = CacheMiddleware(app, {}, data_dir=cache_dir)
app = RegistryManager(app)
app = TestApp(app)


class TestCacheDecorator(TestWSGIController):
    def setUp(self):
        self.app = app
        TestWSGIController.setUp(self)
        environ.update(self.environ)

    def test_default_cache_decorator(self):
        response = self.get_response(action='test_default_cache_decorator')
        assert 'Counter=1' in response
Пример #6
0
 def setUp(self):
     TestWSGIController.setUp(self)
     app = SetupCacheGlobal(ControllerWrap(ValidatingController),
                            self.environ)
     app = RegistryManager(app)
     self.app = TestApp(app)