mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-01 23:12:21 +00:00
* bump * Initial function write * Delete this line from yaml * Changed all the main things - Need help on tests * pylint errors * Tests v0 * Tests v1 * Tests v2 --------- Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
46 lines
1.0 KiB
Python
46 lines
1.0 KiB
Python
# IMPORTATION STANDARD
|
|
|
|
# IMPORTATION THIRDPARTY
|
|
import pytest
|
|
import requests
|
|
|
|
# IMPORTATION INTERNAL
|
|
from openbb_terminal.stocks.comparison_analysis import polygon_model
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def vcr_config():
|
|
return {
|
|
"filter_query_parameters": [
|
|
("apiKey", "MOCK_APIKEY"),
|
|
],
|
|
}
|
|
|
|
|
|
@pytest.mark.vcr
|
|
def test_get_financial_comparisons(recorder):
|
|
result = polygon_model.get_similar_companies(
|
|
symbol="TSLA",
|
|
us_only=True,
|
|
)
|
|
|
|
recorder.capture(result)
|
|
|
|
|
|
@pytest.mark.vcr(record_mode="none")
|
|
def test_get_similar_companies_invalid_status(mocker, recorder):
|
|
mock_response = requests.Response()
|
|
mock_response.status_code = 400
|
|
# pylint: disable=protected-access
|
|
mock_response._content = b"""{"error":"MOCK_ERROR"}"""
|
|
mocker.patch(
|
|
target="openbb_terminal.helper_funcs.requests.get",
|
|
new=mocker.Mock(return_value=mock_response),
|
|
)
|
|
result = polygon_model.get_similar_companies(
|
|
symbol="TSLA",
|
|
us_only=True,
|
|
)
|
|
|
|
recorder.capture(result)
|