add abort() test

This commit is contained in:
Raphael Deem 2017-05-20 14:43:57 -07:00
parent 1a60201f68
commit 5d9c8d59a0

View File

@ -30,6 +30,11 @@ def exception_app():
def handler_invalid(request): def handler_invalid(request):
raise InvalidUsage("OK") raise InvalidUsage("OK")
@app.route('/abort')
def handler_invalid(request):
abort(500)
raise InvalidUsage("OK")
@app.route('/divide_by_zero') @app.route('/divide_by_zero')
def handle_unhandled_exception(request): def handle_unhandled_exception(request):
1 / 0 1 / 0
@ -73,10 +78,10 @@ def test_server_error_exception(exception_app):
assert response.status == 500 assert response.status == 500
def test_invalid_usage_exception(exception_app): def test_abort(exception_app):
"""Test the built-in InvalidUsage exception works""" """Test the built-in InvalidUsage exception works"""
request, response = exception_app.test_client.get('/invalid') request, response = exception_app.test_client.get('/abort')
assert response.status == 400 assert response.status == 500
def test_not_found_exception(exception_app): def test_not_found_exception(exception_app):