add control of access_log argument type
This commit is contained in:
committed by
Sergey Fedoruk
parent
0b728ade3a
commit
a86a10b128
@@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from sanic import Sanic
|
||||
from sanic.config import Config, DEFAULT_CONFIG
|
||||
from sanic.exceptions import PyFileError
|
||||
from sanic.exceptions import PyFileError, ServerError
|
||||
|
||||
|
||||
@contextmanager
|
||||
@@ -223,6 +223,10 @@ def test_config_access_log_passing_in_run(app):
|
||||
app.run(port=1340, access_log=True)
|
||||
assert app.config.ACCESS_LOG == True
|
||||
|
||||
with pytest.raises(ServerError) as e:
|
||||
app.run(port=1340, access_log='string')
|
||||
assert str(e.value) == ("'access_log' passed in 'run' should be boolean")
|
||||
|
||||
|
||||
async def test_config_access_log_passing_in_create_server(app):
|
||||
assert app.config.ACCESS_LOG == True
|
||||
@@ -237,6 +241,10 @@ async def test_config_access_log_passing_in_create_server(app):
|
||||
await app.create_server(port=1342, access_log=True)
|
||||
assert app.config.ACCESS_LOG == True
|
||||
|
||||
with pytest.raises(ServerError) as e:
|
||||
await app.create_server(port=1343, access_log='somestring')
|
||||
assert str(e.value) == ("'access_log' passed in 'create_server' should be boolean")
|
||||
|
||||
|
||||
def test_config_rewrite_keep_alive():
|
||||
config = Config()
|
||||
|
||||
Reference in New Issue
Block a user