Files
OpenBB/tests/openbb_terminal/stocks/fundamental_analysis/test_eodhd_model.py
Igor Radovanovic ed584cfa20 stocks/fa unit tests (#4754)
* Unit tests batch 1

* Unit tests batch 2

* Unit tests batch

* Unit tests batch

* Unit tests batch

* Unit tests batch

* Unit tests batch

* Unit tests batch

* Unit tests batch

* Unit tests batch

* Debloat

* Debloat

* Fix linting
2023-04-12 19:42:09 +00:00

54 lines
1.3 KiB
Python

"""Test the EODHD model."""
import pandas as pd
import pytest
from openbb_terminal.stocks.fundamental_analysis import eodhd_model
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_query_parameters": [
("api_token", "MOCK_API_KEY"),
],
}
@pytest.mark.record_http
@pytest.mark.parametrize(
"symbol, statement, ratios",
[
("TSLA", "balance", True),
("TSLA", "income", False),
("TSLA", "cash", False),
],
)
def test_get_financials(symbol, statement, ratios):
"""Test get_financials."""
eodhd_model.get_financials(symbol=symbol, statement=statement, ratios=ratios)
@pytest.mark.parametrize(
"symbol, statement, ratios",
[
("TSLA", "balance", True),
("TSLA", "income", False),
("TSLA", "cash", False),
],
)
def test_get_financials_mocked(symbol, statement, ratios, mocker):
mocker.patch(
"openbb_terminal.stocks.fundamental_analysis.eodhd_model" + ".get_financials",
return_value=pd.DataFrame(
data=[
["2021-01-01", 0.1, 1000],
["2021-01-01", 0.12, 1200],
["2021-01-01", 0.14, 1400],
],
),
)
getattr(eodhd_model, "get_financials")(
symbol=symbol, statement=statement, ratios=ratios
)