Fixing newly added unit tests in develop
This commit is contained in:
parent
67662f4cb9
commit
76536af552
@ -32,11 +32,11 @@ def refresh_whitelist(whitelist: List[str]) -> List[str]:
|
|||||||
:param whitelist: a new whitelist (optional)
|
:param whitelist: a new whitelist (optional)
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
sanitized_whitelist = [x for x in whitelist if x not in _CONF['exchange'].get('pair_blacklist',[])]
|
sanitized_whitelist = []
|
||||||
health = exchange.get_wallet_health()
|
health = exchange.get_wallet_health()
|
||||||
for status in health:
|
for status in health:
|
||||||
pair = '{}_{}'.format(_CONF['stake_currency'], status['Currency'])
|
pair = '{}_{}'.format(_CONF['stake_currency'], status['Currency'])
|
||||||
if pair not in whitelist:
|
if pair not in whitelist or pair in _CONF['exchange'].get('pair_blacklist',[]):
|
||||||
continue
|
continue
|
||||||
if status['IsActive']:
|
if status['IsActive']:
|
||||||
sanitized_whitelist.append(pair)
|
sanitized_whitelist.append(pair)
|
||||||
|
@ -48,12 +48,13 @@ def test_refresh_whitelist(mocker):
|
|||||||
mocker.patch.dict('freqtrade.main._CONF', conf)
|
mocker.patch.dict('freqtrade.main._CONF', conf)
|
||||||
mocker.patch.multiple('freqtrade.main.exchange',
|
mocker.patch.multiple('freqtrade.main.exchange',
|
||||||
get_wallet_health=get_health)
|
get_wallet_health=get_health)
|
||||||
# no argument: use the whitelist provided by config
|
refreshedwhitelist = refresh_whitelist(conf['exchange']['pair_whitelist'])
|
||||||
refresh_whitelist()
|
print(conf['exchange']['pair_whitelist'])
|
||||||
|
print(refreshedwhitelist)
|
||||||
whitelist = ['BTC_ETH', 'BTC_TKN']
|
whitelist = ['BTC_ETH', 'BTC_TKN']
|
||||||
pairslist = conf['exchange']['pair_whitelist']
|
pairslist = conf['exchange']['pair_whitelist']
|
||||||
# Ensure all except those in whitelist are removed
|
# Ensure all except those in whitelist are removed
|
||||||
assert_list_equal(whitelist, pairslist)
|
assert_list_equal(whitelist, refreshedwhitelist)
|
||||||
|
|
||||||
|
|
||||||
def test_refresh_whitelist_dynamic(mocker):
|
def test_refresh_whitelist_dynamic(mocker):
|
||||||
@ -63,9 +64,8 @@ def test_refresh_whitelist_dynamic(mocker):
|
|||||||
get_wallet_health=get_health)
|
get_wallet_health=get_health)
|
||||||
# argument: use the whitelist dynamically by exchange-volume
|
# argument: use the whitelist dynamically by exchange-volume
|
||||||
whitelist = ['BTC_ETH', 'BTC_TKN']
|
whitelist = ['BTC_ETH', 'BTC_TKN']
|
||||||
refresh_whitelist(whitelist)
|
refreshedwhitelist = refresh_whitelist(whitelist)
|
||||||
pairslist = conf['exchange']['pair_whitelist']
|
assert_list_equal(whitelist, refreshedwhitelist)
|
||||||
assert_list_equal(whitelist, pairslist)
|
|
||||||
|
|
||||||
|
|
||||||
def test_refresh_whitelist_dynamic_empty(mocker):
|
def test_refresh_whitelist_dynamic_empty(mocker):
|
||||||
|
Loading…
Reference in New Issue
Block a user