Files
OpenBB/tests/bots/stocks/technical_analysis/test_obv.py
Colin Delahunty 826cd8a723 Add tests for bots/stocks (#1616)
* Added test_quote

* Added dps tests

* Added more tests

* Added government tests

* Added insider tests

* Added options tests

* Added sia tests

* Added ta tests

* Readd coverage rc

* Added test
2022-04-03 21:13:14 -04:00

50 lines
1.1 KiB
Python

import pytest
try:
from bots.stocks.technical_analysis.obv import obv_command
except ImportError:
pytest.skip(allow_module_level=True)
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
"filter_query_parameters": [
("period1", "MOCK_PERIOD_1"),
("period2", "MOCK_PERIOD_2"),
("date", "MOCK_DATE"),
],
}
@pytest.mark.vcr
@pytest.mark.bots
@pytest.mark.parametrize(
"start, end, extended, heikin, news",
[
("", "", False, False, False),
("2022-01-01", "2022-04-01", True, True, True),
],
)
def test_obv_command(recorder, start, end, extended, heikin, news):
value = obv_command(
"TSLA",
start=start,
end=end,
extended_hours=extended,
heikin_candles=heikin,
news=news,
)
value["imagefile"] = value["imagefile"][-4:]
recorder.capture(value)
@pytest.mark.vcr
@pytest.mark.bots
@pytest.mark.parametrize("ticker", ["", "ZZZZ"])
def test_obv_invalid(ticker):
with pytest.raises(Exception):
obv_command(ticker)