flask/tests
John Zeringue 8bb7185284 Better error message when view return type is not supported
Before, returning a `bool` from a route caused the error

```
[2019-05-31 10:08:42,216] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2070, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py", line 269, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py", line 26, in _run_wsgi_app
    return _run_wsgi_app(*args)
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/test.py", line 1119, in run_wsgi_app
    app_rv = app(environ, start_response)
TypeError: 'bool' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2393, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 1906, in full_dispatch_request
    return self.finalize_request(rv)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 1921, in finalize_request
    response = self.make_response(rv)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2078, in make_response
    reraise(TypeError, new_error, sys.exc_info()[2])
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/_compat.py", line 39, in reraise
    raise value.with_traceback(tb)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2070, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py", line 269, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py", line 26, in _run_wsgi_app
    return _run_wsgi_app(*args)
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/test.py", line 1119, in run_wsgi_app
    app_rv = app(environ, start_response)
TypeError: 'bool' object is not callable
The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a bool.
```

Now, it returns the more readable

```
[2019-05-31 10:36:19,500] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2400, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 1907, in full_dispatch_request
    return self.finalize_request(rv)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 1922, in finalize_request
    response = self.make_response(rv)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2085, in make_response
    " {rv.__class__.__name__}.".format(rv=rv))
TypeError: The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a bool.
```

Fixes #3214
2019-05-31 11:58:49 -04:00
..
static clean up secret key docs 2017-06-28 07:58:06 -07:00
templates Enable autoescape for render_template_string 2015-07-04 23:41:43 +02:00
test_apps Reformat with black 2019-05-06 16:28:58 -04:00
conftest.py Reformat with black 2019-05-06 16:28:58 -04:00
test_appctx.py Reformat with black 2019-05-06 16:28:58 -04:00
test_basic.py Better error message when view return type is not supported 2019-05-31 11:58:49 -04:00
test_blueprints.py Reformat with black 2019-05-06 16:28:58 -04:00
test_cli.py Fix style issues on master using Black 2019-05-31 11:57:28 +01:00
test_config.py Reformat with black 2019-05-06 16:28:58 -04:00
test_helpers.py Fix style issues on master using Black 2019-05-31 11:57:28 +01:00
test_instance_config.py Reformat with black 2019-05-06 16:28:58 -04:00
test_json_tag.py Reformat with black 2019-05-06 16:28:58 -04:00
test_logging.py Reformat with black 2019-05-06 16:28:58 -04:00
test_regression.py Reformat with black 2019-05-06 16:28:58 -04:00
test_reqctx.py Reformat with black 2019-05-06 16:28:58 -04:00
test_signals.py Reformat with black 2019-05-06 16:28:58 -04:00
test_subclassing.py Reformat with black 2019-05-06 16:28:58 -04:00
test_templating.py Reformat with black 2019-05-06 16:28:58 -04:00
test_testing.py fix teardown bug in FlaskClient 2019-05-25 14:03:28 -07:00
test_user_error_handler.py Reformat with black 2019-05-06 16:28:58 -04:00
test_views.py Inherit "methods" in MethodView 2019-05-17 13:57:06 -07:00