Fix rpc messages

This commit is contained in:
Matthias
2018-12-03 20:31:25 +01:00
parent 1b3ecb8343
commit ef1208b366
13 changed files with 59 additions and 36 deletions

View File

@@ -662,12 +662,15 @@ def test_rpc_whitelist(mocker, default_conf) -> None:
def test_rpc_whitelist_dynamic(mocker, default_conf) -> None:
patch_coinmarketcap(mocker)
patch_exchange(mocker)
default_conf['dynamic_whitelist'] = 4
default_conf['whitelist'] = {'method': 'VolumePairList',
'config': {'number_assets': 4}
}
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
freqtradebot = FreqtradeBot(default_conf)
rpc = RPC(freqtradebot)
ret = rpc._rpc_whitelist()
assert ret['method'] == 4
assert ret['method'] == 'VolumePairList'
assert ret['length'] == 4
assert ret['whitelist'] == default_conf['exchange']['pair_whitelist']

View File

@@ -128,7 +128,9 @@ def test_startupmessages_telegram_enabled(mocker, default_conf, caplog) -> None:
telegram_mock.reset_mock()
default_conf['dry_run'] = True
default_conf['dynamic_whitelist'] = 20
default_conf['whitelist'] = {'method': 'VolumePairList',
'config': {'number_assets': 20}
}
rpc_manager.startup_messages(default_conf)
assert telegram_mock.call_count == 3

View File

@@ -1034,7 +1034,9 @@ def test_whitelist_dynamic(default_conf, update, mocker) -> None:
_send_msg=msg_mock
)
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
default_conf['dynamic_whitelist'] = 4
default_conf['whitelist'] = {'method': 'VolumePairList',
'config': {'number_assets': 4}
}
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
telegram = Telegram(freqtradebot)

View File

@@ -54,14 +54,16 @@ def test_refresh_pairlists(mocker, markets, whitelist_conf):
def test_refresh_whitelist_dynamic(mocker, markets, tickers, whitelist_conf):
whitelist_conf['dynamic_whitelist'] = 5
freqtradebot = get_patched_freqtradebot(mocker, whitelist_conf)
whitelist_conf['whitelist'] = {'method': 'VolumePairList',
'config': {'number_assets': 5}
}
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
get_markets=markets,
get_tickers=tickers,
exchange_has=MagicMock(return_value=True)
)
freqtradebot = get_patched_freqtradebot(mocker, whitelist_conf)
# argument: use the whitelist dynamically by exchange-volume
whitelist = ['ETH/BTC', 'TKN/BTC']

View File

@@ -17,7 +17,8 @@ def test_parse_args_none() -> None:
def test_parse_args_defaults() -> None:
args = Arguments([], '').get_parsed_arg()
assert args.config == 'config.json'
assert args.dynamic_whitelist is None
assert args.strategy_path is None
assert args.datadir is None
assert args.loglevel == 0

View File

@@ -102,7 +102,7 @@ def test_load_config(default_conf, mocker) -> None:
assert validated_conf.get('strategy') == 'DefaultStrategy'
assert validated_conf.get('strategy_path') is None
assert 'dynamic_whitelist' not in validated_conf
assert 'edge' not in validated_conf
def test_load_config_with_params(default_conf, mocker) -> None:
@@ -133,7 +133,6 @@ def test_load_config_with_params(default_conf, mocker) -> None:
))
arglist = [
'--dynamic-whitelist', '10',
'--strategy', 'TestStrategy',
'--strategy-path', '/some/path'
]
@@ -152,7 +151,6 @@ def test_load_config_with_params(default_conf, mocker) -> None:
))
arglist = [
'--dynamic-whitelist', '10',
'--strategy', 'TestStrategy',
'--strategy-path', '/some/path'
]

View File

@@ -2532,7 +2532,9 @@ def test_order_book_ask_strategy(default_conf, limit_buy_order, limit_sell_order
def test_startup_messages(default_conf, mocker):
default_conf['dynamic_whitelist'] = 20
default_conf['whitelist'] = {'method': 'VolumePairList',
'config': {'number_assets': 20}
}
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
freqtrade = get_patched_freqtradebot(mocker, default_conf)
assert freqtrade.state is State.RUNNING