Fix refresh_whitelist tests

This commit is contained in:
Matthias 2018-11-30 06:54:20 +01:00
parent e8fbe77ebc
commit 1738633efc
2 changed files with 8 additions and 10 deletions

View File

@ -17,7 +17,7 @@ class StaticList(object):
self._config = config
self._whitelist = self._config['exchange']['pair_whitelist']
self._blacklist = self._config['exchange'].get('pair_blacklist', [])
self.refresh_whitelist()
# self.refresh_whitelist()
@property
def whitelist(self) -> List[str]:

View File

@ -6,9 +6,7 @@ from freqtrade.tests.conftest import get_patched_freqtradebot
import pytest
# whitelist, blacklist, filtering, all of that will
# eventually become some rules to run on a generic ACL engine
# perhaps try to anticipate that by using some python package
# whitelist, blacklist,
@pytest.fixture(scope="function")
@ -33,26 +31,26 @@ def test_refresh_market_pair_not_in_whitelist(mocker, markets, whitelist_conf):
freqtradebot = get_patched_freqtradebot(mocker, whitelist_conf)
mocker.patch('freqtrade.exchange.Exchange.get_markets', markets)
refreshedwhitelist = freqtradebot._refresh_whitelist(
freqtradebot.pairlists.validate_whitelist(
whitelist_conf['exchange']['pair_whitelist'] + ['XXX/BTC']
)
# List ordered by BaseVolume
whitelist = ['ETH/BTC', 'TKN/BTC']
# Ensure all except those in whitelist are removed
assert whitelist == refreshedwhitelist
assert whitelist == freqtradebot.pairlists.whitelist
def test_refresh_whitelist(mocker, markets, whitelist_conf):
freqtradebot = get_patched_freqtradebot(mocker, whitelist_conf)
mocker.patch('freqtrade.exchange.Exchange.get_markets', markets)
refreshedwhitelist = freqtradebot._refresh_whitelist(
freqtradebot.pairlists.validate_whitelist(
whitelist_conf['exchange']['pair_whitelist'])
# List ordered by BaseVolume
whitelist = ['ETH/BTC', 'TKN/BTC']
# Ensure all except those in whitelist are removed
assert whitelist == refreshedwhitelist
assert whitelist == freqtradebot.pairlists.whitelist
def test_refresh_whitelist_dynamic(mocker, markets, tickers, whitelist_conf):
@ -67,11 +65,11 @@ def test_refresh_whitelist_dynamic(mocker, markets, tickers, whitelist_conf):
# argument: use the whitelist dynamically by exchange-volume
whitelist = ['ETH/BTC', 'TKN/BTC']
refreshedwhitelist = freqtradebot._refresh_whitelist(
freqtradebot._refresh_whitelist(
freqtradebot._gen_pair_whitelist(whitelist_conf['stake_currency'])
)
assert whitelist == refreshedwhitelist
assert whitelist == freqtradebot.pairlists.whitelist
def test_refresh_whitelist_dynamic_empty(mocker, markets_empty, whitelist_conf):