Check for a request ctx before using the request.

Use the app json coder when blueprint json coder is set to none.
Revert the failling test to using an app_context
re #1710
This commit is contained in:
RamiC 2016-06-08 12:50:43 +03:00
parent 501b8590dd
commit 4305ebdf66
2 changed files with 13 additions and 6 deletions

View file

@ -90,12 +90,12 @@ class TestJSON(object):
app = flask.Flask(__name__)
app.config['JSON_AS_ASCII'] = True
with app.test_request_context():
with app.app_context():
rv = flask.json.dumps(u'\N{SNOWMAN}')
assert rv == '"\\u2603"'
app.config['JSON_AS_ASCII'] = False
with app.test_request_context():
with app.app_context():
rv = flask.json.dumps(u'\N{SNOWMAN}')
assert rv == u'"\u2603"'