sanic/sanic/utils.py

18 lines
647 B
Python
Raw Normal View History

2017-02-14 19:51:20 +00:00
import warnings
2017-02-16 02:54:00 +00:00
2017-03-08 00:39:26 +00:00
from sanic.testing import SanicTestClient
def sanic_endpoint_test(app, method='get', uri='/', gather_request=True,
2017-02-14 19:51:20 +00:00
debug=False, server_kwargs={},
*request_args, **request_kwargs):
warnings.warn(
"Use of sanic_endpoint_test will be deprecated in"
2017-02-14 20:16:58 +00:00
"the next major version after 0.4.0. Please use the `test_client` "
"available on the app object.", DeprecationWarning)
2017-02-14 19:51:20 +00:00
2017-03-08 00:39:26 +00:00
test_client = SanicTestClient(app)
2017-02-14 19:51:20 +00:00
return test_client._sanic_endpoint_test(
method, uri, gather_request, debug, server_kwargs,
*request_args, **request_kwargs)