2011-09-05 18:52:28 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
"""
|
2014-08-31 21:54:45 +02:00
|
|
|
tests.subclassing
|
2014-09-21 16:47:38 +02:00
|
|
|
~~~~~~~~~~~~~~~~~
|
2011-09-05 18:52:28 +02:00
|
|
|
|
|
|
|
|
Test that certain behavior of flask can be customized by
|
|
|
|
|
subclasses.
|
|
|
|
|
|
2018-02-08 10:57:40 -08:00
|
|
|
:copyright: © 2010 by the Pallets team.
|
2011-09-05 18:52:28 +02:00
|
|
|
:license: BSD, see LICENSE for more details.
|
|
|
|
|
"""
|
|
|
|
|
import flask
|
2013-05-22 01:33:04 +02:00
|
|
|
from flask._compat import StringIO
|
2011-09-05 18:52:28 +02:00
|
|
|
|
|
|
|
|
|
2014-09-03 20:50:54 +02:00
|
|
|
def test_suppressed_exception_logging():
|
|
|
|
|
class SuppressedFlask(flask.Flask):
|
|
|
|
|
def log_exception(self, exc_info):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
out = StringIO()
|
|
|
|
|
app = SuppressedFlask(__name__)
|
|
|
|
|
|
2019-05-06 15:39:41 -04:00
|
|
|
@app.route("/")
|
2014-09-03 20:50:54 +02:00
|
|
|
def index():
|
2019-05-06 15:39:41 -04:00
|
|
|
raise Exception("test")
|
2014-09-03 20:50:54 +02:00
|
|
|
|
2019-05-06 15:39:41 -04:00
|
|
|
rv = app.test_client().get("/", errors_stream=out)
|
2014-09-03 20:50:54 +02:00
|
|
|
assert rv.status_code == 500
|
2019-05-06 15:39:41 -04:00
|
|
|
assert b"Internal Server Error" in rv.data
|
2017-07-28 14:55:52 -07:00
|
|
|
assert not out.getvalue()
|