forked from orbit-oss/flask
Add negative test for json.jsonify (#1876)
Test if jsonify function raises TypeError when both args and kwargs are passed in. Check the TypeError's message
This commit is contained in:
parent
225c311f1b
commit
e048aa4e19
1 changed files with 8 additions and 0 deletions
|
|
@ -1031,6 +1031,14 @@ def test_jsonify_mimetype():
|
|||
assert rv.mimetype == 'application/vnd.api+json'
|
||||
|
||||
|
||||
def test_jsonify_args_and_kwargs_check():
|
||||
app = flask.Flask(__name__)
|
||||
with app.test_request_context():
|
||||
with pytest.raises(TypeError) as e:
|
||||
flask.jsonify('fake args', kwargs='fake')
|
||||
assert 'behavior undefined' in str(e.value)
|
||||
|
||||
|
||||
def test_url_generation():
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue