Skip to content
Myr

Added testcase for the debug behavior and explicit encoding

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 3400b78 · Browse files · 2 files+21 added−1 removed
This commit

State

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

Diff stats

2 files+21 added−1 removed

  • tests:+20 added−0 removed
  • other:+1 added−1 removed

2 files+21 added−1 removed

modified:flask/debughelpers.py+1 added-1 removed
25 unmodified lines
26 if form_matches:27 buf.append('\n\nThe browser instead transmitted some file names. '28 'This was submitted: %s' % ', '.join('"%s"' % x29 for x in form_matches))30 self.msg = ''.join(buf)30 self.msg = ''.join(buf).encode('utf-8')3132 def __str__(self):33 return self.msg34
18 unmodified lines
modified:tests/flask_tests.py+20 added
624 unmodified lines
625 pass626 else:627 self.fail('Expected exception')628629 def test_enctype_debug_helper(self):630 from flask.debughelpers import DebugFilesKeyError631 app = flask.Flask(__name__)632 app.debug = True633 @app.route('/fail', methods=['POST'])634 def index():635 return flask.request.files['foo'].filename636637 # with statement is important because we leave an exception on the638 # stack otherwise and we want to ensure that this is not the case639 # to not negatively affect other tests.640 with app.test_client() as c:641 try:642 c.post('/fail', data={'foo': 'index.txt'})643 except DebugFilesKeyError, e:644 assert 'no file contents were transmitted' in str(e)645 assert 'This was submitted: "index.txt"' in str(e)646 else:647 self.fail('Expected exception')648649 def test_teardown_on_pop(self):650 buffer = []651 app = flask.Flask(__name__)652 @app.teardown_request
1387 unmodified lines