Fix #2935: Copy current session object in copy_current_request_context (#2936)

Add session to RequestContext.copy()
This commit is contained in:
Dave Chevell 2018-11-04 14:32:24 +11:00 committed by David Lord
parent 7e714bd28b
commit e08bcf9f97
3 changed files with 22 additions and 6 deletions

View file

@ -156,6 +156,7 @@ class TestGreenletContextCopying(object):
@app.route('/')
def index():
flask.session['fizz'] = 'buzz'
reqctx = flask._request_ctx_stack.top.copy()
def g():
@ -166,6 +167,7 @@ class TestGreenletContextCopying(object):
assert flask.current_app == app
assert flask.request.path == '/'
assert flask.request.args['foo'] == 'bar'
assert flask.session.get('fizz') == 'buzz'
assert not flask.request
return 42
@ -183,6 +185,7 @@ class TestGreenletContextCopying(object):
@app.route('/')
def index():
flask.session['fizz'] = 'buzz'
reqctx = flask._request_ctx_stack.top.copy()
@flask.copy_current_request_context
@ -191,6 +194,7 @@ class TestGreenletContextCopying(object):
assert flask.current_app == app
assert flask.request.path == '/'
assert flask.request.args['foo'] == 'bar'
assert flask.session.get('fizz') == 'buzz'
return 42
greenlets.append(greenlet(g))