Files
OpenBB/tests/test_fa/test_fa_controller.py
colin99d 81337b4fdd Improved Testing Framework (#665)
* Reduced test time by 85% using vcrpy

* Refactored tests with decorator

* Added vcrpy dependencies

* Fixed issues with tests

* Fixed tests not running in local

Co-authored-by: Colin Delahunty <colindelahunty@Colins-Air.attlocal.net>
2021-08-13 12:05:32 -04:00

33 lines
942 B
Python

""" fundamental_analysis/fa_controller.py tests """
from datetime import datetime, timedelta
from contextlib import contextmanager
import unittest
import sys
import io
from gamestonk_terminal.stocks.fundamental_analysis import fa_controller
from tests.helpers import check_print
@contextmanager
def replace_stdin(target):
orig = sys.stdin
sys.stdin = target
yield
sys.stdin = orig
class TestFaController(unittest.TestCase):
start = datetime.now() - timedelta(days=200)
menuClass = fa_controller.FundamentalAnalysisController("GME", start, "1440min") # type: ignore
choices = fa_controller.FundamentalAnalysisController.CHOICES
@check_print(assert_in="fraud")
def test_fa_controller_help(self):
self.menuClass.print_help()
@check_print(assert_in="fraud")
def test_menu(self):
with replace_stdin(io.StringIO("q")):
fa_controller.menu("GME", self.start, "1440min")