* add fixtures to conftest.py * use fixtures in test_appctx.py * use fixtures in test_blueprints.py * use fixtures in test_depreciations.py * use fixtures in test_regressions.py * use fixtures in test_reqctx.py * use fixtures in test_templating.py * use fixtures in test_user_error_handler.py * use fixtures in test_views.py * use fixtures in test_basics.py * use fixtures in test_helpers.py * use fixtures in test_testing.py * update conftest.py * make docstrings PEP-257 compliant * cleanup * switch dictonary format * use pytest parameterization for test_json_as_unicode
41 lines
1 KiB
Python
41 lines
1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
tests.deprecations
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
Tests deprecation support. Not used currently.
|
|
|
|
:copyright: (c) 2015 by Armin Ronacher.
|
|
:license: BSD, see LICENSE for more details.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
import flask
|
|
|
|
|
|
class TestRequestDeprecation(object):
|
|
def test_request_json(self, recwarn, app, client):
|
|
"""Request.json is deprecated"""
|
|
app.testing = True
|
|
|
|
@app.route('/', methods=['POST'])
|
|
def index():
|
|
assert flask.request.json == {'spam': 42}
|
|
print(flask.request.json)
|
|
return 'OK'
|
|
|
|
client.post('/', data='{"spam": 42}', content_type='application/json')
|
|
recwarn.pop(DeprecationWarning)
|
|
|
|
def test_request_module(self, recwarn, app, client):
|
|
"""Request.module is deprecated"""
|
|
app.testing = True
|
|
|
|
@app.route('/')
|
|
def index():
|
|
assert flask.request.module is None
|
|
return 'OK'
|
|
|
|
client.get('/')
|
|
recwarn.pop(DeprecationWarning)
|