Refactor pairlist-tests

This commit is contained in:
Matthias 2018-12-03 20:48:51 +01:00
parent 18ad3388b4
commit 0929f59680
3 changed files with 14 additions and 2 deletions

View File

@ -15,7 +15,7 @@ DEFAULT_DB_DRYRUN_URL = 'sqlite://'
UNLIMITED_STAKE_AMOUNT = 'unlimited'
REQUIRED_ORDERTYPES = ['buy', 'sell', 'stoploss', 'stoploss_on_exchange']
ORDERTYPE_POSSIBILITIES = ['limit', 'market']
AVAILABLE_PAIRLISTS = ['StaticPairList', 'VolumePairList']
TICKER_INTERVAL_MINUTES = {
'1m': 1,
@ -127,7 +127,7 @@ CONF_SCHEMA = {
'whitelist': {
'type': 'object',
'properties': {
'method': {'type': 'string'},
'method': {'type': 'string', 'enum': AVAILABLE_PAIRLISTS},
'config': {'type': 'object'}
},
'required': ['method']

View File

View File

@ -3,6 +3,7 @@
from unittest.mock import MagicMock
from freqtrade import OperationalException
from freqtrade.constants import AVAILABLE_PAIRLISTS
from freqtrade.tests.conftest import get_patched_freqtradebot
import pytest
@ -22,6 +23,9 @@ def whitelist_conf(default_conf):
default_conf['exchange']['pair_blacklist'] = [
'BLK/BTC'
]
default_conf['whitelist'] = {'method': 'StaticPairList',
'config': {'number_assets': 3}
}
return default_conf
@ -118,3 +122,11 @@ def test_gen_pair_whitelist_not_supported(mocker, default_conf, tickers) -> None
with pytest.raises(OperationalException):
get_patched_freqtradebot(mocker, default_conf)
@pytest.mark.parametrize("pairlist", AVAILABLE_PAIRLISTS)
def test_pairlist_class(mocker, whitelist_conf, pairlist):
whitelist_conf['whitelist']['method'] = pairlist
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
assert freqtrade.pairlists.name == pairlist
# TODO: add more tests