rename TestClient
This commit is contained in:
parent
19592e8eea
commit
58a833e987
|
@ -17,7 +17,7 @@ from sanic.response import HTTPResponse, StreamingHTTPResponse
|
||||||
from sanic.router import Router
|
from sanic.router import Router
|
||||||
from sanic.server import serve, serve_multiple, HttpProtocol
|
from sanic.server import serve, serve_multiple, HttpProtocol
|
||||||
from sanic.static import register as static_register
|
from sanic.static import register as static_register
|
||||||
from sanic.testing import TestClient
|
from sanic.testing import SanicTestClient
|
||||||
from sanic.views import CompositionView
|
from sanic.views import CompositionView
|
||||||
from sanic.websocket import WebSocketProtocol, ConnectionClosed
|
from sanic.websocket import WebSocketProtocol, ConnectionClosed
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ class Sanic:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def test_client(self):
|
def test_client(self):
|
||||||
return TestClient(self)
|
return SanicTestClient(self)
|
||||||
|
|
||||||
# -------------------------------------------------------------------- #
|
# -------------------------------------------------------------------- #
|
||||||
# Execution
|
# Execution
|
||||||
|
|
|
@ -4,7 +4,7 @@ HOST = '127.0.0.1'
|
||||||
PORT = 42101
|
PORT = 42101
|
||||||
|
|
||||||
|
|
||||||
class TestClient:
|
class SanicTestClient:
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from sanic.testing import TestClient
|
from sanic.testing import SanicTestClient
|
||||||
|
|
||||||
|
|
||||||
def sanic_endpoint_test(app, method='get', uri='/', gather_request=True,
|
def sanic_endpoint_test(app, method='get', uri='/', gather_request=True,
|
||||||
|
@ -11,7 +11,7 @@ def sanic_endpoint_test(app, method='get', uri='/', gather_request=True,
|
||||||
"the next major version after 0.4.0. Please use the `test_client` "
|
"the next major version after 0.4.0. Please use the `test_client` "
|
||||||
"available on the app object.", DeprecationWarning)
|
"available on the app object.", DeprecationWarning)
|
||||||
|
|
||||||
test_client = TestClient(app)
|
test_client = SanicTestClient(app)
|
||||||
return test_client._sanic_endpoint_test(
|
return test_client._sanic_endpoint_test(
|
||||||
method, uri, gather_request, debug, server_kwargs,
|
method, uri, gather_request, debug, server_kwargs,
|
||||||
*request_args, **request_kwargs)
|
*request_args, **request_kwargs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user