def ws_ctx(path, app=None): builder = ScopeBuilder(path) scope_data = builder.get_data()[0] scope_data.update(type='websocket', scheme='wss') token = current._init_(FakeWSContext, app, scope_data, None, None) yield current current._close_(token)
def test_request(): scope, _ = ScopeBuilder( path='/?foo=bar', method='GET', ).get_data() request = Request(scope, None, None) assert request.query_params == {'foo': 'bar'} assert request.client == '127.0.0.1'
def current_ctx(app, path): builder = ScopeBuilder(path) token = current._init_(FakeRequestContext, app, builder.get_data()[0]) yield current current._close_(token)
def ctx(): builder = ScopeBuilder() token = current._init_(FakeRequestContext, None, builder.get_data()[0], None, None) yield current current._close_(token)