Exemplo n.º 1
0
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)
    ]
Exemplo n.º 2
0
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',)
Exemplo n.º 3
0
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)
    ]
Exemplo n.º 4
0
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)
    ]
Exemplo n.º 5
0
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', )
Exemplo n.º 6
0
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)
    ]
Exemplo n.º 7
0
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)
    ]
Exemplo n.º 8
0
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)
    ]