Document-Audit-RAG / tests /test_config.py
Mayank Chugh
Deploy DocuAudit AI to Hugging Face Space (no binaries)
d44b33d
raw
history blame contribute delete
835 Bytes
"""Settings behaviour for Hugging Face Spaces and Hub tokens."""
from api.config import Settings
def test_space_id_without_llm_provider_env_uses_huggingface_and_hf_token(monkeypatch):
monkeypatch.setenv("SPACE_ID", "author/repo")
monkeypatch.delenv("LLM_PROVIDER", raising=False)
monkeypatch.delenv("HUGGINGFACE_API_KEY", raising=False)
monkeypatch.setenv("HF_TOKEN", "hf_test_token")
s = Settings(_env_file=None)
assert s.llm_provider == "huggingface"
assert s.huggingface_api_key == "hf_test_token"
def test_space_id_respects_explicit_llm_provider_ollama(monkeypatch):
monkeypatch.setenv("SPACE_ID", "author/repo")
monkeypatch.setenv("LLM_PROVIDER", "ollama")
monkeypatch.delenv("HUGGINGFACE_API_KEY", raising=False)
s = Settings(_env_file=None)
assert s.llm_provider == "ollama"