Files
OpenBB/tests/openbb_terminal/stocks/comparison_analysis/test_finnhub_model.py
Henrique Joaquim a37d9032e3 Hotfix/fix black (#4101)
* Fix plot look when using eval and add query to choices (#3881)

* convert index to datetime and update choices

* uncomment economy integration test

* fix treasury concat bug

* fix datasets concat on duplciates

* Lock ruff version so that new lints dont break our CI (#3905)

* Lock ruff version so that new lints dont break our CI

* Bumped pre-commit ruff version

* returning always a dataframe

* Revert "returning always a dataframe"

This reverts commit d5dbf3132f.

* black everything

---------
2023-02-01 12:33:15 +00:00

42 lines
955 B
Python

# IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.comparison_analysis import finnhub_model
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_query_parameters": [
("token", "MOCK_TOKEN"),
],
}
@pytest.mark.vcr
def test_get_similar_companies(recorder):
result = finnhub_model.get_similar_companies(symbol="TSLA")
recorder.capture(result)
@pytest.mark.vcr(record_mode="none")
def test_get_similar_companies_invalid_status(mocker, recorder):
attrs = {
"status_code": 400,
"json.return_value": {"error": "mock error message"},
}
mock_response = mocker.Mock(**attrs)
mocker.patch(
target="openbb_terminal.helper_funcs.requests.get",
new=mocker.Mock(return_value=mock_response),
)
result = finnhub_model.get_similar_companies(symbol="TSLA")
recorder.capture(result)