mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
* add EIA daily spot prices data via FRED * line too long * comment out the test skipped test * fix test? * delete commented out sections * unused argument * name things like Minh says --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""Test Commodity extension."""
|
|
|
|
import pytest
|
|
from openbb_core.app.model.obbject import OBBject
|
|
|
|
# pylint: disable=redefined-outer-name
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def obb(pytestconfig): # pylint: disable=inconsistent-return-statements
|
|
"""Fixture to setup obb."""
|
|
if pytestconfig.getoption("markexpr") != "not integration":
|
|
import openbb # pylint: disable=import-outside-toplevel
|
|
|
|
return openbb.obb
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
(
|
|
{
|
|
"commodity": "all",
|
|
"start_date": None,
|
|
"end_date": None,
|
|
"frequency": None,
|
|
"transform": None,
|
|
"aggregation_method": None,
|
|
"provider": "fred",
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_commodity_price_spot(params, obb):
|
|
"""Test the commodity spot prices endpoint."""
|
|
params = {p: v for p, v in params.items() if v}
|
|
|
|
result = obb.commodity.price.spot(**params)
|
|
assert result
|
|
assert isinstance(result, OBBject)
|
|
assert len(result.results) > 0
|