Fix app.create_server calls
This commit is contained in:
parent
0242bc999f
commit
eed22a7a24
|
@ -25,7 +25,7 @@ def test_create_asyncio_server(app):
|
|||
asyncio_srv_coro = app.create_server(return_asyncio_server=True)
|
||||
assert isawaitable(asyncio_srv_coro)
|
||||
srv = loop.run_until_complete(asyncio_srv_coro)
|
||||
assert isinstance(srv, asyncio_base_events.Server)
|
||||
assert srv.is_serving() is True
|
||||
|
||||
|
||||
def test_asyncio_server_start_serving(app):
|
||||
|
|
|
@ -231,10 +231,12 @@ async def test_config_access_log_passing_in_create_server(app):
|
|||
async def _request(sanic, loop):
|
||||
app.stop()
|
||||
|
||||
await app.create_server(port=1341, access_log=False)
|
||||
await app.create_server(port=1341, access_log=False,
|
||||
return_asyncio_server=True)
|
||||
assert app.config.ACCESS_LOG == False
|
||||
|
||||
await app.create_server(port=1342, access_log=True)
|
||||
await app.create_server(port=1342, access_log=True,
|
||||
return_asyncio_server=True)
|
||||
assert app.config.ACCESS_LOG == True
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ except BaseException:
|
|||
|
||||
|
||||
def test_logo_base(app, caplog):
|
||||
server = app.create_server(debug=True)
|
||||
server = app.create_server(
|
||||
debug=True, return_asyncio_server=True)
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
loop._stopping = False
|
||||
|
@ -31,7 +32,8 @@ def test_logo_base(app, caplog):
|
|||
def test_logo_false(app, caplog):
|
||||
app.config.LOGO = False
|
||||
|
||||
server = app.create_server(debug=True)
|
||||
server = app.create_server(
|
||||
debug=True, return_asyncio_server=True)
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
loop._stopping = False
|
||||
|
@ -50,7 +52,8 @@ def test_logo_false(app, caplog):
|
|||
def test_logo_true(app, caplog):
|
||||
app.config.LOGO = True
|
||||
|
||||
server = app.create_server(debug=True)
|
||||
server = app.create_server(
|
||||
debug=True, return_asyncio_server=True)
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
loop._stopping = False
|
||||
|
@ -69,7 +72,8 @@ def test_logo_true(app, caplog):
|
|||
def test_logo_custom(app, caplog):
|
||||
app.config.LOGO = "My Custom Logo"
|
||||
|
||||
server = app.create_server(debug=True)
|
||||
server = app.create_server(
|
||||
debug=True, return_asyncio_server=True)
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
loop._stopping = False
|
||||
|
|
|
@ -83,7 +83,8 @@ async def test_trigger_before_events_create_server(app):
|
|||
async def init_db(app, loop):
|
||||
app.db = MySanicDb()
|
||||
|
||||
await app.create_server()
|
||||
await app.create_server(
|
||||
debug=True, return_asyncio_server=True)
|
||||
|
||||
assert hasattr(app, "db")
|
||||
assert isinstance(app.db, MySanicDb)
|
||||
|
|
Loading…
Reference in New Issue
Block a user