Skip to content
Myr

Add test for deprecated flask.Request properties.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by INADA Naoki · committed by INADA Naoki · parent 61097c4 · Browse files · 1 file+40 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+40 added−0 removed

  • tests:+40 added−0 removed

1 file+40 added−0 removed

modified:tests/test_deprecations.py+40 added
6 unmodified lines
78 :copyright: (c) 2014 by Armin Ronacher.9 :license: BSD, see LICENSE for more details.10"""1112import pytest1314import flask151617class TestRequestDeprecation(object):1819 def test_request_json(self, catch_deprecation_warnings):20 """Request.json is deprecated"""21 app = flask.Flask(__name__)22 app.testing = True2324 @app.route('/', methods=['POST'])25 def index():26 assert flask.request.json == {'spam': 42}27 print(flask.request.json)28 return 'OK'2930 with catch_deprecation_warnings() as captured:31 c = app.test_client()32 c.post('/', data='{"spam": 42}', content_type='application/json')3334 assert len(captured) == 13536 def test_request_module(self, catch_deprecation_warnings):37 """Request.module is deprecated"""38 app = flask.Flask(__name__)39 app.testing = True4041 @app.route('/')42 def index():43 assert flask.request.module is None44 return 'OK'4546 with catch_deprecation_warnings() as captured:47 c = app.test_client()48 c.get('/')4950 assert len(captured) == 1