Skip to content

Commit

Permalink
Add test for jsonify padded=False, pallets#495.
Browse files Browse the repository at this point in the history
  • Loading branch information
rduplain committed Apr 21, 2012
1 parent 2ae2338 commit d90f0af
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flask/testsuite/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ def return_kwargs():
@app.route('/dict')
def return_dict():
return flask.jsonify(d)
@app.route("/unpadded")
def return_padded_false():
return flask.jsonify(d, padded=False)
@app.route("/padded")
def return_padded_json():
def return_padded_true():
return flask.jsonify(d, padded=True)
@app.route("/padded_custom")
def return_padded_json_custom_callback():
return flask.jsonify(d, padded='my_func_name')
c = app.test_client()
for url in '/kw', '/dict':
for url in '/kw', '/dict', '/unpadded':
rv = c.get(url)
self.assert_equal(rv.mimetype, 'application/json')
self.assert_equal(flask.json.loads(rv.data), d)
Expand Down

0 comments on commit d90f0af

Please sign in to comment.