def test_app_run_default_port(web_run_app_mock, aiohttp_api_spec_dir): app = AioHttpApp(__name__, specification_dir=aiohttp_api_spec_dir, debug=True) app.run() assert web_run_app_mock.call_args_list == [ mock.call(app.app, port=5000, host='0.0.0.0', access_log=None) ]
def test_app_run_server_error(web_run_app_mock, aiohttp_api_spec_dir): app = AioHttpApp(__name__, port=5001, specification_dir=aiohttp_api_spec_dir) with pytest.raises(Exception) as exc_info: app.run(server='other') assert exc_info.value.args == ('Server other not recognized',)
def test_app_run_debug(web_run_app_mock, aiohttp_api_spec_dir): app = AioHttpApp(__name__, port=5001, specification_dir=aiohttp_api_spec_dir) app.add_api('swagger_simple.yaml') app.run(debug=True) assert web_run_app_mock.call_args_list == [ mock.call(app.app, port=5001, host='0.0.0.0', access_log=None) ]
def test_app_run_default_port(web_run_app_mock, aiohttp_api_spec_dir): app = AioHttpApp(__name__, specification_dir=aiohttp_api_spec_dir, debug=True) app.run() assert web_run_app_mock.call_args_list == [ mock.call(app.app, port=5000, host='0.0.0.0', access_log=None) ]
def test_app_run_server_error(web_run_app_mock, aiohttp_api_spec_dir): app = AioHttpApp(__name__, port=5001, specification_dir=aiohttp_api_spec_dir) with pytest.raises(Exception) as exc_info: app.run(server='other') assert exc_info.value.args == ('Server other not recognized', )
def test_app_run_debug(web_run_app_mock, aiohttp_api_spec_dir): app = AioHttpApp(__name__, port=5001, specification_dir=aiohttp_api_spec_dir) app.add_api('swagger_simple.yaml') app.run(debug=True) assert web_run_app_mock.call_args_list == [ mock.call(app.app, port=5001, host='0.0.0.0', access_log=None) ]
def test_app_run(web_run_app_mock, aiohttp_api_spec_dir): app = AioHttpApp(__name__, port=5001, specification_dir=aiohttp_api_spec_dir, debug=True) app.run(use_default_access_log=True) logger = logging.getLogger('connexion.aiohttp_app') assert web_run_app_mock.call_args_list == [ mock.call(app.app, port=5001, host='0.0.0.0', access_log=logger) ]
def test_app_run(web_run_app_mock, aiohttp_api_spec_dir): app = AioHttpApp(__name__, port=5001, specification_dir=aiohttp_api_spec_dir, debug=True) app.run(use_default_access_log=True) logger = logging.getLogger('connexion.aiohttp_app') assert web_run_app_mock.call_args_list == [ mock.call(app.app, port=5001, host='0.0.0.0', access_log=logger) ]