Files
kca/server/tests/helpers/asynctest.py
T
woggioni 4f3a632f4b Implement KCA: web reimplementation of XCA PKI workflows
- 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
2026-10-23 02:06:55 +00:00

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