Files
OpenBB/openbb_platform/extensions/commodity/integration/test_commodity_python.py
Danglewood b9de848bc3 [Feature] Add EIA Daily Spot Prices Data via FRED (#6677)
* 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>
2024-10-03 19:47:44 +00:00

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