DRYing up the test suite using pytest fixtures (#2306)
* 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
This commit is contained in:
parent
81c2440a05
commit
5b0b9717da
12 changed files with 1004 additions and 979 deletions
|
|
@ -15,10 +15,8 @@ import flask
|
|||
|
||||
|
||||
class TestRequestDeprecation(object):
|
||||
|
||||
def test_request_json(self, recwarn):
|
||||
def test_request_json(self, recwarn, app, client):
|
||||
"""Request.json is deprecated"""
|
||||
app = flask.Flask(__name__)
|
||||
app.testing = True
|
||||
|
||||
@app.route('/', methods=['POST'])
|
||||
|
|
@ -27,13 +25,11 @@ class TestRequestDeprecation(object):
|
|||
print(flask.request.json)
|
||||
return 'OK'
|
||||
|
||||
c = app.test_client()
|
||||
c.post('/', data='{"spam": 42}', content_type='application/json')
|
||||
client.post('/', data='{"spam": 42}', content_type='application/json')
|
||||
recwarn.pop(DeprecationWarning)
|
||||
|
||||
def test_request_module(self, recwarn):
|
||||
def test_request_module(self, recwarn, app, client):
|
||||
"""Request.module is deprecated"""
|
||||
app = flask.Flask(__name__)
|
||||
app.testing = True
|
||||
|
||||
@app.route('/')
|
||||
|
|
@ -41,6 +37,5 @@ class TestRequestDeprecation(object):
|
|||
assert flask.request.module is None
|
||||
return 'OK'
|
||||
|
||||
c = app.test_client()
|
||||
c.get('/')
|
||||
client.get('/')
|
||||
recwarn.pop(DeprecationWarning)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue