Warn on None responses.
This commit is contained in:
parent
dc3f13df54
commit
a862ead5f2
2 changed files with 20 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ import sys
|
|||
import flask
|
||||
import unittest
|
||||
import tempfile
|
||||
import warnings
|
||||
|
||||
|
||||
example_path = os.path.join(os.path.dirname(__file__), '..', 'examples')
|
||||
|
|
@ -224,6 +225,19 @@ class BasicFunctionalityTestCase(unittest.TestCase):
|
|||
assert flask.url_for('static', filename='index.html') \
|
||||
== '/static/index.html'
|
||||
|
||||
def test_none_response(self):
|
||||
warnings.filterwarnings('error', 'View function did not return')
|
||||
app = flask.Flask(__name__)
|
||||
@app.route('/')
|
||||
def test():
|
||||
return None
|
||||
try:
|
||||
app.test_client().get('/')
|
||||
except Warning:
|
||||
pass
|
||||
else:
|
||||
assert "Expected warning"
|
||||
|
||||
|
||||
class JSONTestCase(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue