test_throttle.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:websauna 作者: websauna 项目源码 文件源码
def throttle_app(request, paster_config):
    '''Custom WSGI app with permission test views enabled.'''

    class Initializer(websauna.system.Initializer):

        def configure_views(self):
            self.config.add_route("throttle_sample", "/")
            self.config.add_view(throttle_sample, route_name="throttle_sample", decorator=throttled_view(limit=1))

        def configure_csrf(self):
            """Disable CSRF for this test run for making testing simpler."""
            self.config.set_default_csrf_options(require_csrf=False)

    global_config, app_settings = paster_config
    init = Initializer(global_config, app_settings)
    init.run()
    app = TestApp(init.make_wsgi_app())
    app.init = init
    return app
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号