Initial commit of integrated agent system
This commit is contained in:
30
backend/tests/test_provider_router.py
Normal file
30
backend/tests/test_provider_router.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Tests for provider router fallback behavior."""
|
||||
|
||||
from backend.data.provider_router import DataProviderRouter
|
||||
from backend.config.data_config import reset_config
|
||||
|
||||
|
||||
def test_router_includes_local_csv_fallback(monkeypatch):
|
||||
monkeypatch.delenv("FINNHUB_API_KEY", raising=False)
|
||||
monkeypatch.delenv("FINANCIAL_DATASETS_API_KEY", raising=False)
|
||||
monkeypatch.delenv("FIN_DATA_SOURCE", raising=False)
|
||||
monkeypatch.delenv("ENABLED_DATA_SOURCES", raising=False)
|
||||
reset_config()
|
||||
|
||||
router = DataProviderRouter()
|
||||
|
||||
assert router.price_sources() == ["local_csv"]
|
||||
|
||||
|
||||
def test_router_allows_yfinance_when_enabled(monkeypatch):
|
||||
monkeypatch.setenv("FIN_DATA_SOURCE", "yfinance")
|
||||
monkeypatch.setenv("ENABLED_DATA_SOURCES", "yfinance,local_csv")
|
||||
monkeypatch.delenv("FINNHUB_API_KEY", raising=False)
|
||||
monkeypatch.delenv("FINANCIAL_DATASETS_API_KEY", raising=False)
|
||||
reset_config()
|
||||
|
||||
router = DataProviderRouter()
|
||||
|
||||
assert router.price_sources() == ["yfinance", "local_csv"]
|
||||
assert router.api_sources() == ["yfinance"]
|
||||
Reference in New Issue
Block a user