Exemplo n.º 1
0
def initialize_fakes(app):
    # Set up WSGI interceptor. This sets up a fake host that responds each
    # time httplib tries to communicate to localhost, port 8779.
    def wsgi_interceptor(*args, **kwargs):
        def call_back(env, start_response):
            path_info = env.get('PATH_INFO')
            if path_info:
                env['PATH_INFO'] = urllib.parse.unquote(path_info)
            return app.__call__(env, start_response)

        return call_back

    wsgi_intercept.add_wsgi_intercept('localhost', CONF.bind_port,
                                      wsgi_interceptor)
    from trove.tests.util import event_simulator
    event_simulator.monkey_patch()
    from trove.tests.fakes import taskmanager
    taskmanager.monkey_patch()
Exemplo n.º 2
0
def initialize_fakes(app):
    # Set up WSGI interceptor. This sets up a fake host that responds each
    # time httplib tries to communicate to localhost, port 8779.
    def wsgi_interceptor(*args, **kwargs):
        def call_back(env, start_response):
            path_info = env.get("PATH_INFO")
            if path_info:
                env["PATH_INFO"] = urllib.parse.unquote(path_info)
            return app.__call__(env, start_response)

        return call_back

    wsgi_intercept.add_wsgi_intercept("localhost", CONF.bind_port, wsgi_interceptor)
    from trove.tests.util import event_simulator

    event_simulator.monkey_patch()
    from trove.tests.fakes import taskmanager

    taskmanager.monkey_patch()