Add test for enum failed

This commit is contained in:
hroff-1902 2020-02-15 04:32:10 +03:00
parent 93f9ff1b63
commit 29d9b6a46a

View File

@ -30,7 +30,7 @@ def test_search_strategy():
assert s is None assert s is None
def test_search_all_strategies(): def test_search_all_strategies_no_failed():
directory = Path(__file__).parent directory = Path(__file__).parent
strategies = StrategyResolver.search_all_objects(directory, enum_failed=False) strategies = StrategyResolver.search_all_objects(directory, enum_failed=False)
assert isinstance(strategies, list) assert isinstance(strategies, list)
@ -38,6 +38,15 @@ def test_search_all_strategies():
assert isinstance(strategies[0], dict) assert isinstance(strategies[0], dict)
def test_search_all_strategies_with_failed():
directory = Path(__file__).parent
strategies = StrategyResolver.search_all_objects(directory, enum_failed=True)
assert isinstance(strategies, list)
assert len(strategies) == 4
assert isinstance(strategies[0], dict)
assert strategies[0]['class'] is None
def test_load_strategy(default_conf, result): def test_load_strategy(default_conf, result):
default_conf.update({'strategy': 'SampleStrategy', default_conf.update({'strategy': 'SampleStrategy',
'strategy_path': str(Path(__file__).parents[2] / 'freqtrade/templates') 'strategy_path': str(Path(__file__).parents[2] / 'freqtrade/templates')