From e048aa4e19d689104733783a19560a6a485a473c Mon Sep 17 00:00:00 2001 From: dawran6 Date: Fri, 3 Jun 2016 10:58:39 -0700 Subject: [PATCH] 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 --- tests/test_basic.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_basic.py b/tests/test_basic.py index 95417c35..55687359 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -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__)