re-enable log_all_requests
re-enable log_all_request - with excludelogging for internal
This commit is contained in:
parent
70fdfdb1b3
commit
e4130e4626
2 changed files with 120 additions and 86 deletions
|
|
@ -9,6 +9,9 @@ import pytest_aiohttp
|
|||
import pytest_asyncio
|
||||
import datetime, time
|
||||
from aiohttp import web
|
||||
import logging
|
||||
from testfixtures import LogCapture
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
|
||||
def create_confserver():
|
||||
|
|
@ -37,6 +40,31 @@ async def test_confserver_ssl():
|
|||
conf_server.confserver_app()
|
||||
asyncio.create_task(conf_server.start_server())
|
||||
|
||||
async def test_confserver_exceptions():
|
||||
with LogCapture() as l:
|
||||
|
||||
conf_server = bumper.ConfServer(("127.0.0.1", 8007), usessl=True)
|
||||
conf_server.confserver_app()
|
||||
conf_server.site = web.TCPSite
|
||||
|
||||
#bind permission
|
||||
conf_server.site.start = mock.Mock(side_effect=OSError(1, "error while attempting to bind on address ('127.0.0.1', 8007): permission denied"))
|
||||
await conf_server.start_server()
|
||||
|
||||
#asyncio Cancel
|
||||
conf_server.site = web.TCPSite
|
||||
conf_server.site.start = mock.Mock(side_effect=asyncio.CancelledError)
|
||||
await conf_server.start_server()
|
||||
|
||||
#general exception
|
||||
conf_server.site = web.TCPSite
|
||||
conf_server.site.start = mock.Mock(side_effect=Exception(1, "general"))
|
||||
await conf_server.start_server()
|
||||
|
||||
l.check_present(
|
||||
("confserver", "ERROR", "error while attempting to bind on address ('127.0.0.1', 8007): permission denied")
|
||||
)
|
||||
|
||||
|
||||
async def test_confserver_no_ssl():
|
||||
conf_server = bumper.ConfServer(("127.0.0.1", 111111), usessl=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue