- kaya backend with OIDC sessions, API tokens, Postgres/Tortoise models - AES-256-GCM private key storage and full certificate/CSR/CRL domain logic - Sycamore/WASM SPA for vaults, keys, requests, certificates, CRLs and templates - imports/exports, XCA .xdb migration, Docker Compose stack and tests
24 lines
640 B
Python
24 lines
640 B
Python
"""``async_test`` that closes the app's per-loop Tortoise context."""
|
|
from __future__ import annotations
|
|
|
|
import asyncio
|
|
from functools import wraps
|
|
from typing import Any, Callable, Coroutine
|
|
|
|
from kca.app import tortoise_mixin
|
|
|
|
|
|
def async_test(coro: Callable[..., Coroutine[Any, Any, None]]) -> Callable[..., None]:
|
|
@wraps(coro)
|
|
def wrapper(*args: Any, **kwargs: Any) -> None:
|
|
async def run() -> None:
|
|
try:
|
|
await coro(*args, **kwargs)
|
|
finally:
|
|
await tortoise_mixin.aclose()
|
|
|
|
with asyncio.Runner() as runner:
|
|
runner.run(run())
|
|
|
|
return wrapper
|