Download backend/tests/conftest.py from SolutionChallenge/solution_challenge_backend: direct link, hf CLI and curl.
- Browser
- Download file 948 Bytes
-
https://huggingface.co/spaces/SolutionChallenge/solution_challenge_backend/resolve/main/backend/tests/conftest.py
- Command line
-
hf download hf://spaces/SolutionChallenge/solution_challenge_backend/backend/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/spaces/SolutionChallenge/solution_challenge_backend/resolve/main/backend/tests/conftest.py
948 Bytes
| import os | |
| import pytest | |
| 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 | |