Ejemplo n.º 1
0
    def setUp(self):
        self.config = get_config()
        self.proxy = FakeProxy()
        self.config.registry['proxy'] = self.proxy

        self.app = self.config.make_wsgi_app()
        self.client = webtest.TestApp(self.app)
Ejemplo n.º 2
0
def start_vaurien_httpserver(port):
    """Start a vaurien httpserver, controlling a fake proxy"""
    config = get_config()
    config.registry['proxy'] = FakeProxy()

    server = WSGIServer(('localhost', int(port)), config.make_wsgi_app(),
                        log=None)
    server.serve_forever()
Ejemplo n.º 3
0
def start_vaurien_httpserver(port):
    """Start a vaurien httpserver, controlling a fake proxy"""
    config = get_config()
    config.registry['proxy'] = FakeProxy()

    server = WSGIServer(('localhost', int(port)),
                        config.make_wsgi_app(),
                        log=None)
    server.serve_forever()
Ejemplo n.º 4
0
    statsd = get_statsd_from_settings(settings.getsection('statsd'))

    # creating the proxy
    proxy_args = dict(proxy=settings['vaurien.proxy'],
                      backend=settings['vaurien.backend'],
                      settings=settings, statsd=statsd, logger=logger,
                      protocol=args.protocol)

    if args.http:
        # if we are using the http server, then we want to use the OnTheFly
        # proxy
        proxy = OnTheFlyProxy(**proxy_args)
        from vaurien.webserver import get_config
        from gevent.pywsgi import WSGIServer

        config = get_config()
        config.registry['proxy'] = proxy
        app = config.make_wsgi_app()

        # configure the web app logger
        # configure_logger(app.logger, args.loglevel, args.logoutput)

        # app.run(host=args.http_host, port=args.http_port)
        http_server = WSGIServer((args.http_host, args.http_port), app,
                                 log=DevNull())

        http_server.start()
        logger.info('Started the HTTP server: http://%s:%s' %
                    (args.http_host, args.http_port))
    else:
        # per default, we want to randomize
Ejemplo n.º 5
0
    # creating the proxy
    proxy_args = dict(proxy=settings['vaurien.proxy'],
                      backend=settings['vaurien.backend'],
                      settings=settings,
                      statsd=statsd,
                      logger=logger,
                      protocol=args.protocol)

    if args.http:
        # if we are using the http server, then we want to use the OnTheFly
        # proxy
        proxy = OnTheFlyProxy(**proxy_args)
        from vaurien.webserver import get_config
        from gevent.pywsgi import WSGIServer

        config = get_config()
        config.registry['proxy'] = proxy
        app = config.make_wsgi_app()

        # configure the web app logger
        # configure_logger(app.logger, args.loglevel, args.logoutput)

        # app.run(host=args.http_host, port=args.http_port)
        http_server = WSGIServer((args.http_host, args.http_port),
                                 app,
                                 log=DevNull())

        http_server.start()
        logger.info('Started the HTTP server: http://%s:%s' %
                    (args.http_host, args.http_port))
    else: