Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mocking #4577

Merged
merged 3 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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