mirror of
https://github.com/QuantEngines/fx_quant_engine.git
synced 2026-07-31 20:37:45 +00:00
Initial commit: fx_quant_engine and options_quant_engine scaffold
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from options_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"])
|
||||
Reference in New Issue
Block a user