github-actions
Deploy to Hugging Face
c794b6b
Raw
History Blame Contribute Delete
948 Bytes
import os
import pytest
@pytest.fixture(autouse=True)
def _isolate_auth_env(request):
"""Contract tests disable JWT; auth tests opt in via module env."""
os.environ["CEPHEUS_API_KEY"] = "test-key"
os.environ.setdefault("CEPHEUS_DEV_JWT_SECRET", "test-jwt-secret-for-ci-min-32-chars!!")
os.environ.setdefault(
"CEPHEUS_DEV_AUTH_USERS",
'[{"username":"admin","password":"admin","role":"admin"},'
'{"username":"staff","password":"staff","role":"staff"}]',
)
os.environ.pop("CEPHEUS_PRODUCTION", None)
module = request.module.__name__
if module.endswith("test_auth") or module.endswith("test_refresh_store"):
os.environ["CEPHEUS_AUTH_DEV_MODE"] = "1"
else:
os.environ.pop("CEPHEUS_AUTH_DEV_MODE", None)
os.environ.pop("CEPHEUS_JWT_SECRET", None)
try:
import main as main_module
main_module.API_KEY = "test-key"
except Exception:
pass