Browse Source

Fix for testing

pull/2845/head
fourjr 7 years ago
parent
commit
7751b25d53
  1. 2
      flask/json/__init__.py
  2. 12
      tests/test_helpers.py

2
flask/json/__init__.py

@ -292,7 +292,7 @@ def jsonify(*args, **kwargs):
} }
.. versionchanged:: 0.11 .. versionchanged:: 1.1
Added support for status parameter Added support for status parameter
This function's response will be pretty printed if the This function's response will be pretty printed if the

12
tests/test_helpers.py

@ -244,7 +244,17 @@ class TestJSON(object):
assert rv_uuid == test_uuid assert rv_uuid == test_uuid
def test_jsonify_status(self, app, client): def test_jsonify_status(self, app, client):
flask.jsonify({'code': 400}, status=400) @app.route('/statusarg')
def return_arg_status():
return flask.jsonify({'code': 400}, status=400)
@app.route('/statuskwarg')
def return_kwarg_status():
return flask.jsonify(code=400, status=400)
for url in '/statuskwarg', '/statusarg':
rv = client.get(url)
assert rv.status_code == 400
def test_json_attr(self, app, client): def test_json_attr(self, app, client):

Loading…
Cancel
Save