fix: soft-deleted permission readd
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""Shared test bootstrap.
|
||||
|
||||
Loads the repo-root ``.env`` so modules that import ``common.config``
|
||||
(which is a process-wide singleton) can resolve ``APP_CONFIG_SECRET_KEY``
|
||||
at collection time. Without it, any test importing ``backend.api.*`` fails
|
||||
with a RuntimeError about ENC(...) ciphertext.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
_REPO_ROOT = Path(__file__).resolve().parent.parent.parent
|
||||
|
||||
|
||||
def _bootstrap() -> None:
|
||||
if os.environ.get("APP_CONFIG_SECRET_KEY"):
|
||||
return
|
||||
env_file = _REPO_ROOT / ".env"
|
||||
if not env_file.is_file():
|
||||
return
|
||||
try:
|
||||
from dotenv import dotenv_values
|
||||
except ImportError:
|
||||
return
|
||||
value = dotenv_values(env_file).get("APP_CONFIG_SECRET_KEY")
|
||||
if value:
|
||||
os.environ["APP_CONFIG_SECRET_KEY"] = value
|
||||
|
||||
|
||||
_bootstrap()
|
||||
Reference in New Issue
Block a user