Resolve tests
This commit is contained in:
parent
76ef641743
commit
c32e7fd678
|
@ -1035,7 +1035,7 @@ class Sanic:
|
|||
def test_client(self):
|
||||
if self._test_client:
|
||||
return self._test_client
|
||||
from sanic_testing.testing import SanicTestClient
|
||||
from sanic_testing.testing import SanicTestClient # type: ignore
|
||||
|
||||
self._test_client = SanicTestClient(self)
|
||||
return self._test_client
|
||||
|
@ -1044,7 +1044,7 @@ class Sanic:
|
|||
def asgi_client(self):
|
||||
if self._asgi_client:
|
||||
return self._asgi_client
|
||||
from sanic_testing.testing import SanicASGITestClient
|
||||
from sanic_testing.testing import SanicASGITestClient # type: ignore
|
||||
|
||||
self._asgi_client = SanicASGITestClient(self)
|
||||
return self._asgi_client
|
||||
|
|
|
@ -6,14 +6,6 @@ from sanic_testing.testing import PORT
|
|||
from sanic.config import BASE_LOGO
|
||||
|
||||
|
||||
try:
|
||||
import uvloop # noqa
|
||||
|
||||
ROW = 0
|
||||
except BaseException:
|
||||
ROW = 1
|
||||
|
||||
|
||||
def test_logo_base(app, caplog):
|
||||
server = app.create_server(
|
||||
debug=True, return_asyncio_server=True, port=PORT
|
||||
|
@ -29,8 +21,8 @@ def test_logo_base(app, caplog):
|
|||
loop.run_until_complete(_server.wait_closed())
|
||||
app.stop()
|
||||
|
||||
assert caplog.record_tuples[ROW][1] == logging.DEBUG
|
||||
assert caplog.record_tuples[ROW][2] == BASE_LOGO
|
||||
assert caplog.record_tuples[0][1] == logging.DEBUG
|
||||
assert caplog.record_tuples[0][2] == BASE_LOGO
|
||||
|
||||
|
||||
def test_logo_false(app, caplog):
|
||||
|
@ -50,8 +42,8 @@ def test_logo_false(app, caplog):
|
|||
loop.run_until_complete(_server.wait_closed())
|
||||
app.stop()
|
||||
|
||||
banner, port = caplog.record_tuples[ROW][2].rsplit(":", 1)
|
||||
assert caplog.record_tuples[ROW][1] == logging.INFO
|
||||
banner, port = caplog.record_tuples[0][2].rsplit(":", 1)
|
||||
assert caplog.record_tuples[0][1] == logging.INFO
|
||||
assert banner == "Goin' Fast @ http://127.0.0.1"
|
||||
assert int(port) > 0
|
||||
|
||||
|
@ -73,8 +65,8 @@ def test_logo_true(app, caplog):
|
|||
loop.run_until_complete(_server.wait_closed())
|
||||
app.stop()
|
||||
|
||||
assert caplog.record_tuples[ROW][1] == logging.DEBUG
|
||||
assert caplog.record_tuples[ROW][2] == BASE_LOGO
|
||||
assert caplog.record_tuples[0][1] == logging.DEBUG
|
||||
assert caplog.record_tuples[0][2] == BASE_LOGO
|
||||
|
||||
|
||||
def test_logo_custom(app, caplog):
|
||||
|
@ -94,5 +86,5 @@ def test_logo_custom(app, caplog):
|
|||
loop.run_until_complete(_server.wait_closed())
|
||||
app.stop()
|
||||
|
||||
assert caplog.record_tuples[ROW][1] == logging.DEBUG
|
||||
assert caplog.record_tuples[ROW][2] == "My Custom Logo"
|
||||
assert caplog.record_tuples[0][1] == logging.DEBUG
|
||||
assert caplog.record_tuples[0][2] == "My Custom Logo"
|
||||
|
|
Loading…
Reference in New Issue
Block a user