Merge pull request #525 from r0fls/518

rename TestClient
This commit is contained in:
Raphael Deem 2017-03-08 18:24:13 -08:00 committed by GitHub
commit 2fe9e78b6d
3 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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)