Browse Source

Added a testcase for 404 errors caused by the routing system

pull/293/head
Armin Ronacher 14 years ago
parent
commit
fafcc02f26
  1. 12
      tests/flask_tests.py

12
tests/flask_tests.py

@ -564,6 +564,18 @@ class BasicFunctionalityTestCase(unittest.TestCase):
assert rv.status_code == 500
assert 'internal server error' == rv.data
def test_before_request_and_routing_errors(self):
app = flask.Flask(__name__)
@app.before_request
def attach_something():
flask.g.something = 'value'
@app.errorhandler(404)
def return_something(error):
return flask.g.something, 404
rv = app.test_client().get('/')
assert rv.status_code == 404
assert rv.data == 'value'
def test_user_error_handling(self):
class MyException(Exception):
pass

Loading…
Cancel
Save