async def test_generated_view_info_as_title(): apps = (web.Application(), ) spec = generate_oas(apps, title_spec="test title") assert spec == { 'info': { 'title': 'test title', 'version': '1.0.0' }, 'openapi': '3.0.0' }
async def test_generated_view_info_as_version(): apps = (web.Application(), ) spec = generate_oas(apps, version_spec="test version") assert spec == { 'info': { 'title': 'Aiohttp pydantic application', 'version': 'test version' }, 'openapi': '3.0.0' }
async def test_generated_view_info_default(): apps = (web.Application(), ) spec = generate_oas(apps) assert spec == { 'info': { 'title': 'Aiohttp pydantic application', 'version': '1.0.0' }, 'openapi': '3.0.0' }
async def test_generated_view_info_as_title(): apps = (web.Application(), ) spec = generate_oas(apps, title_spec="test title") assert spec == { "info": { "title": "test title", "version": "1.0.0" }, "openapi": "3.0.0", }
async def test_generated_view_info_as_version(): apps = (web.Application(), ) spec = generate_oas(apps, version_spec="test version") assert spec == { "info": { "title": "Aiohttp pydantic application", "version": "test version" }, "openapi": "3.0.0", }
async def create_app(): app = web.Application() settings = Settings() app.update( settings=settings, static_root_url='/static/', ) jinja2_loader = jinja2.FileSystemLoader(str(THIS_DIR / 'templates')) aiohttp_jinja2.setup(app, loader=jinja2_loader) app.on_startup.append(startup) app.on_cleanup.append(cleanup) aiohttp_session.setup(app, EncryptedCookieStorage(settings.auth_key, cookie_name=settings.cookie_name)) basePath = settings.base_path logger.info(f'App BASE_PATH={basePath}') # Register platform endpoints app.add_routes([web.get('/alive', k8s_alive), web.get('/ready', k8s_ready), web.get(basePath+'/oas/spec', oas_spec) ]) # Register application endpoints app.router.add_view(basePath+'/article', ArticleView) # app.router.add_get('/', index, name='index') # app.router.add_route('*', '/messages', messages, name='messages') # app.router.add_get('/messages/data', message_data, name='message-data') app['oas_spec'] = base_spec() app['oas_spec'].update(generate_oas([app])) print(f'OAS Spec = {app["oas_spec"]}') # oas.setup(app) for resource in app.router.resources(): logger.info(resource) print(resource) return app