Files
OpenBB/cli/integration/test_commands.py
Igor Radovanovic 37903a1cae [Feature] - CLI integration tests (#6533)
* Integration test batch 1

* Mark test

* Update cli/integration/test_integration_obbject_registry.py

Co-authored-by: Henrique Joaquim <henriquecjoaquim@gmail.com>

* example of command tests

* Add more test cases

---------

Co-authored-by: Henrique Joaquim <henriquecjoaquim@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
2024-06-26 12:14:50 +00:00

30 lines
975 B
Python

import io
import pytest
from openbb_cli.cli import main
@pytest.mark.parametrize(
"input_values",
[
"/equity/price/historical --symbol aapl --provider fmp",
"/equity/price/historical --symbol msft --provider yfinance",
"/equity/price/historical --symbol goog --provider polygon",
"/crypto/price/historical --symbol btc --provider fmp",
"/currency/price/historical --symbol eur --provider fmp",
"/derivatives/futures/historical --symbol cl --provider fmp",
"/etf/price/historical --symbol spy --provider fmp",
"/economy",
],
)
@pytest.mark.integration
def test_launch_with_cli_input(monkeypatch, input_values):
"""Test launching the CLI and providing input via stdin with multiple parameters."""
stdin = io.StringIO(input_values)
monkeypatch.setattr("sys.stdin", stdin)
try:
main()
except Exception as e:
pytest.fail(f"Main function raised an exception: {e}")