Added a testcase for 404 errors caused by the routing system
This commit is contained in:
parent
eba2f70c6b
commit
fafcc02f26
1 changed files with 12 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue