latest_prices: include_expired passthrough for historical data (#2)
CI / test (push) Successful in 19s
CI / build-push (push) Successful in 5s

This commit was merged in pull request #2.
This commit is contained in:
2026-06-08 19:45:03 -04:00
parent bb4219da87
commit 831c3e19de
3 changed files with 42 additions and 4 deletions
+24
View File
@@ -71,6 +71,30 @@ def test_get_drops_none_params(monkeypatch):
assert captured["params"] == {"commodity": "corn"}
def test_latest_include_expired_passthrough(monkeypatch):
client = _reload_client(monkeypatch)
captured = {}
class FakeResp:
status_code = 200
text = ""
def json(self): return {"count": 0, "rows": []}
def fake_get(url, params=None, timeout=None, headers=None):
captured["params"] = dict(params or {})
return FakeResp()
monkeypatch.setattr(client.httpx, "get", fake_get)
# Default: not sent, so the API applies its current+future filter.
client.latest(commodity="corn")
assert "include_expired" not in captured["params"]
# Opt in: forwarded so the API returns expired months too.
client.latest(commodity="corn", include_expired=True)
assert captured["params"] == {"commodity": "corn", "include_expired": True}
def test_futures_endpoint_params(monkeypatch):
client = _reload_client(monkeypatch)
captured = {}