Skip to content

Commit

Permalink
Fix mocking (#4577)
Browse files Browse the repository at this point in the history
* fix mocking

* run tests?

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
  • Loading branch information
IgorWounds and piiq authored Mar 24, 2023
1 parent e300071 commit 50a20ae
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
4 changes: 2 additions & 2 deletions openbb_terminal/alternative/alt_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ def call_covid(self, _):

@log_start_end(log=logger)
def call_oss(self, _):
"""Process oss command"""
"""Process oss command."""
from openbb_terminal.alternative.oss.oss_controller import OSSController

self.queue = self.load_class(OSSController, self.queue)

@log_start_end(log=logger)
def call_hn(self, other_args: List[str]):
"""Process hn command"""
"""Process hn command."""

parser = argparse.ArgumentParser(
add_help=False,
Expand Down

This file was deleted.

5 changes: 4 additions & 1 deletion tests/openbb_terminal/mutual_funds/test_mstrapy_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

from openbb_terminal.mutual_funds import mstarpy_model

EXAMPLE_FUND = mstarpy_model.load_funds(term="Vanguard", country="US")
EXAMPLE_FUND = Funds(
"Vanguard",
"US",
)


@pytest.mark.record_http()
Expand Down
17 changes: 8 additions & 9 deletions tests/openbb_terminal/mutual_funds/test_mstrapy_view.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
"""Test the mstrapy view."""

import pytest
from mstarpy import Funds

from openbb_terminal.mutual_funds import mstarpy_model, mstarpy_view
from openbb_terminal.mutual_funds import mstarpy_view

EXAMPLE_FUND = mstarpy_model.load_funds(term="Vanguard", country="US")
EXAMPLE_FUND = Funds(
"Vanguard",
"US",
)


def test_display_carbon_metrics():
Expand All @@ -15,7 +19,6 @@ def test_display_exclusion_policy():
mstarpy_view.display_exclusion_policy(loaded_funds=EXAMPLE_FUND)


@pytest.mark.record_verify_screen
@pytest.mark.parametrize(
"loaded_fund, start_date, end_date, kwargs",
[
Expand All @@ -28,14 +31,12 @@ def test_display_exclusion_policy():
],
)
def test_display_historical(loaded_fund, start_date, end_date, kwargs):
chart = mstarpy_view.display_historical(
mstarpy_view.display_historical(
loaded_funds=loaded_fund,
start_date=start_date,
end_date=end_date,
**kwargs,
)
assert chart is not None
assert hasattr(chart, "save")


@pytest.mark.record_verify_screen
Expand Down Expand Up @@ -74,8 +75,6 @@ def test_display_search(term, country, limit):
],
)
def test_display_sector(loaded_fund, asset_type, external_axes):
chart = mstarpy_view.display_sector(
mstarpy_view.display_sector(
loaded_funds=loaded_fund, asset_type=asset_type, external_axes=external_axes
)
assert chart is not None
assert hasattr(chart, "to_html")
18 changes: 12 additions & 6 deletions tests/openbb_terminal/mutual_funds/test_mutual_fund_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ def __call__(self, *args, **kwargs):
)

controller = mutual_fund_controller.FundController(queue=None)
controller.call_load(["--fund", "UNH"])
getattr(controller, "call_load")(["--fund", "UNH"])

assert controller.queue == []


Expand Down Expand Up @@ -252,7 +253,8 @@ def __call__(self, *args, **kwargs):
)

controller = mutual_fund_controller.FundController(queue=None)
controller.call_country([])
getattr(controller, "call_country")([])

assert controller.queue == []


Expand Down Expand Up @@ -284,7 +286,8 @@ def __call__(self, *args, **kwargs):
)

controller = mutual_fund_controller.FundController(queue=None)
controller.call_plot([])
getattr(controller, "call_plot")([])

assert controller.queue == []


Expand Down Expand Up @@ -320,7 +323,8 @@ def __call__(self, *args, **kwargs):
)

controller = mutual_fund_controller.FundController(queue=None)
controller.call_sector([])
getattr(controller, "call_sector")([])

assert controller.queue == []


Expand Down Expand Up @@ -355,7 +359,8 @@ def __call__(self, *args, **kwargs):
)

controller = mutual_fund_controller.FundController(queue=None)
controller.call_holdings([])
getattr(controller, "call_holdings")([])

assert controller.queue == []


Expand Down Expand Up @@ -390,7 +395,8 @@ def __call__(self, *args, **kwargs):
)

controller = mutual_fund_controller.FundController(queue=None)
controller.call_carbon([])
getattr(controller, "call_carbon")([])

assert controller.queue == []


Expand Down

0 comments on commit 50a20ae

Please sign in to comment.