async def quiz_executor_and_schema( args: argparse.Namespace, session: aiohttp.ClientSession ) -> Tuple[quiz.execution.async_executor, quiz.Schema]: async_executor = quiz.async_executor( url="https://api.github.com/graphql", auth=snug.header_adder({"Authorization": f"Bearer {args.github_auth_token}"}), client=session, ) result = await async_executor(quiz.INTROSPECTION_QUERY) schema: quiz.Schema = quiz.Schema.from_raw( result["__schema"], scalars=(), module=None ) log.debug("fetched github graphql schema") return async_executor, schema
async def quiz_executor_and_schema( config: GithubClientConfig, session: aiohttp.ClientSession ) -> Tuple[quiz.execution.async_executor, quiz.Schema]: async_executor = quiz.async_executor( url=config["base_url"], auth=snug.header_adder( {"Authorization": f"Bearer {config['github_auth_token']}"}), client=session, ) result = await async_executor(quiz.INTROSPECTION_QUERY) schema: quiz.Schema = quiz.Schema.from_raw(result["__schema"], scalars=(), module=None) log.debug("fetched github graphql schema") return async_executor, schema
def test_async_executor(): executor = quiz.async_executor(url='https://my.url/graphql') assert executor.func is quiz.execute_async assert executor.keywords['url'] == 'https://my.url/graphql'
def test_async_executor(): executor = quiz.async_executor(url="https://my.url/graphql") assert executor.func is quiz.execute_async assert executor.keywords["url"] == "https://my.url/graphql"