mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 07:23:25 +00:00
* quick econ fix * black * keys and feature flags * terminal name 👀 * some more replacements * some more replacements * edit pyproject * gst -> openbb * add example portfolios back to git * Update api from gst * sorry. skipping some tests * another round of names * another round of test edits * Missed some .gst refs and update timezone * water mark stuff * Fixing Names in terminal.spec and name of GTFF_DEFAULTS to OBBFF_DEFAULTS * fix more GST to OpenBB Terminal * Logging : merge conflicts with main * Revert wrong files Co-authored-by: Andrew <andrew.kenreich@gmail.com> Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt> Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
69 lines
1.6 KiB
Python
69 lines
1.6 KiB
Python
# IMPORTATION STANDARD
|
|
|
|
# IMPORTATION THIRDPARTY
|
|
import pytest
|
|
|
|
# IMPORTATION INTERNAL
|
|
from openbb_terminal.cryptocurrency.discovery import pycoingecko_view
|
|
|
|
|
|
@pytest.mark.vcr
|
|
@pytest.mark.record_stdout
|
|
@pytest.mark.parametrize(
|
|
"func, kwargs",
|
|
[
|
|
("display_coins", dict(category="analytics")),
|
|
("display_gainers", dict()),
|
|
("display_losers", dict()),
|
|
("display_trending", dict()),
|
|
],
|
|
)
|
|
def test_call_func(func, kwargs, mocker):
|
|
# MOCK EXPORT_DATA
|
|
mocker.patch(
|
|
target="openbb_terminal.cryptocurrency.discovery.pycoingecko_view.export_data"
|
|
)
|
|
|
|
getattr(pycoingecko_view, func)(**kwargs)
|
|
|
|
|
|
@pytest.mark.vcr(record_mode="none")
|
|
@pytest.mark.record_stdout
|
|
@pytest.mark.parametrize(
|
|
"func, kwargs, mocked_func",
|
|
[
|
|
(
|
|
"display_coins",
|
|
dict(category="analytics"),
|
|
"get_coins",
|
|
),
|
|
(
|
|
"display_gainers",
|
|
dict(),
|
|
"get_gainers_or_losers",
|
|
),
|
|
(
|
|
"display_losers",
|
|
dict(),
|
|
"get_gainers_or_losers",
|
|
),
|
|
(
|
|
"display_trending",
|
|
dict(),
|
|
"get_trending_coins",
|
|
),
|
|
],
|
|
)
|
|
def test_call_func_empty_df(func, kwargs, mocked_func, mocker):
|
|
view_path = "openbb_terminal.cryptocurrency.discovery.pycoingecko_view"
|
|
|
|
# MOCK MOCKED_FUNC
|
|
attrs = {"empty": True}
|
|
mock_empty_df = mocker.Mock(**attrs)
|
|
mocker.patch(
|
|
target=f"{view_path}.pycoingecko_model.{mocked_func}",
|
|
return_value=mock_empty_df,
|
|
)
|
|
|
|
getattr(pycoingecko_view, func)(**kwargs)
|