Added a test for content length behavior

This commit is contained in:
Armin Ronacher 2011-05-27 15:59:11 +02:00
parent 34e6933832
commit e3f2dd8f08
1 changed files with 16 additions and 0 deletions

View File

@ -782,6 +782,22 @@ class BasicFunctionalityTestCase(unittest.TestCase):
t.start()
t.join()
def test_max_content_length(self):
app = flask.Flask(__name__)
app.debug = True
app.config['MAX_CONTENT_LENGTH'] = 64
@app.route('/accept', methods=['POST'])
def accept_file():
flask.request.form['myfile']
assert False
@app.errorhandler(413)
def catcher(error):
return '42'
c = app.test_client()
rv = c.post('/accept', data={'myfile': 'foo' * 100})
assert rv.data == '42'
class JSONTestCase(unittest.TestCase):