Files

24 lines
846 B
Python

import base64
import json
import pytest
from core.config import get_settings
TEST_JWT_SECRET = "test_jwt_secret_key_32chars_padded"
TEST_AUDIT_KEY_B64 = base64.b64encode(b"T" * 32).decode()
TEST_KEYRING_JSON = json.dumps({"test_key_1": TEST_AUDIT_KEY_B64})
@pytest.fixture(autouse=True)
def settings_override(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("ANTHROPIC_AUTH_TOKEN", "sk-ant-test-not-real")
monkeypatch.setenv("ANTHROPIC_BASE_URL", "https://api.anthropic.com")
monkeypatch.setenv("DATABASE_URL", "postgresql+asyncpg://test:test@localhost/test_db")
monkeypatch.setenv("JWT_SECRET_KEY", TEST_JWT_SECRET)
monkeypatch.setenv("AUDIT_KEYRING_JSON", TEST_KEYRING_JSON)
monkeypatch.setenv("AUDIT_ACTIVE_KEY_ID", "test_key_1")
get_settings.cache_clear()
yield
get_settings.cache_clear()