import pytest from fx_quant_engine.ingestion.credentials import load_credentials def test_load_credentials_success(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setenv("BREEZE_API_KEY", "k") monkeypatch.setenv("BREEZE_API_SECRET", "s") creds = load_credentials("BREEZE", required=["API_KEY", "API_SECRET"]) assert creds.get("api_key") == "k" assert creds.get("api_secret") == "s" def test_load_credentials_missing_required(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.delenv("ZERODHA_API_KEY", raising=False) monkeypatch.delenv("ZERODHA_ACCESS_TOKEN", raising=False) with pytest.raises(RuntimeError): load_credentials("ZERODHA", required=["API_KEY", "ACCESS_TOKEN"])