forked from orbit-oss/flask
failing test
This commit is contained in:
parent
706e67ed9e
commit
5c12acefbb
1 changed files with 33 additions and 0 deletions
|
|
@ -980,6 +980,39 @@ def test_http_error_subclass_handling(app, client):
|
|||
assert client.get('/3').data == b'apple'
|
||||
|
||||
|
||||
def test_errorhandler_precedence(app, client):
|
||||
class E1(Exception):
|
||||
pass
|
||||
|
||||
class E2(Exception):
|
||||
pass
|
||||
|
||||
class E3(E1, E2):
|
||||
pass
|
||||
|
||||
@app.errorhandler(E2)
|
||||
def handle_e2(e):
|
||||
return 'E2'
|
||||
|
||||
@app.errorhandler(Exception)
|
||||
def handle_exception(e):
|
||||
return 'Exception'
|
||||
|
||||
@app.route('/E1')
|
||||
def raise_e1():
|
||||
raise E1
|
||||
|
||||
@app.route('/E3')
|
||||
def raise_e3():
|
||||
raise E3
|
||||
|
||||
rv = client.get('/E1')
|
||||
assert rv.data == b'Exception'
|
||||
|
||||
rv = client.get('/E3')
|
||||
assert rv.data == b'E2'
|
||||
|
||||
|
||||
def test_trapping_of_bad_request_key_errors(app, client):
|
||||
@app.route('/fail')
|
||||
def fail():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue