flask/tests/test_subclassing.py

34 lines
698 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
"""
2014-09-01 03:54:45 +08:00
tests.subclassing
2014-09-21 22:47:38 +08:00
~~~~~~~~~~~~~~~~~
Test that certain behavior of flask can be customized by
subclasses.
2019-06-23 04:09:09 +08:00
:copyright: 2010 Pallets
:license: BSD-3-Clause
"""
import flask
2014-09-04 03:02:03 +08:00
from flask._compat import StringIO
2014-09-04 02:50:54 +08:00
def test_suppressed_exception_logging():
class SuppressedFlask(flask.Flask):
def log_exception(self, exc_info):
pass
out = StringIO()
app = SuppressedFlask(__name__)
@app.route('/')
def index():
raise Exception('test')
2014-09-04 02:50:54 +08:00
rv = app.test_client().get('/', errors_stream=out)
2014-09-04 02:50:54 +08:00
assert rv.status_code == 500
assert b'Internal Server Error' in rv.data
assert not out.getvalue()