Skip to content

Commit

Permalink
Resolve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Jan 25, 2021
1 parent 76ef641 commit c32e7fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions sanic/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ async def handle_request(self, request):
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
Expand All @@ -1044,7 +1044,7 @@ def test_client(self):
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
Expand Down
24 changes: 8 additions & 16 deletions tests/test_logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
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
Expand All @@ -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):
Expand All @@ -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

Expand All @@ -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):
Expand All @@ -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"

0 comments on commit c32e7fd

Please sign in to comment.