fix test
This commit is contained in:
parent
cb9849e192
commit
7ffe65770e
@ -253,17 +253,18 @@ def test__load_markets(default_conf, mocker, caplog):
|
|||||||
def test__reload_markets(default_conf, mocker, caplog):
|
def test__reload_markets(default_conf, mocker, caplog):
|
||||||
caplog.set_level(logging.DEBUG)
|
caplog.set_level(logging.DEBUG)
|
||||||
initial_markets = {'ETH/BTC': {}}
|
initial_markets = {'ETH/BTC': {}}
|
||||||
|
|
||||||
|
def load_markets(*args, **kwargs):
|
||||||
|
exchange._api.markets = updated_markets
|
||||||
|
|
||||||
api_mock = MagicMock()
|
api_mock = MagicMock()
|
||||||
|
api_mock.load_markets = load_markets
|
||||||
type(api_mock).markets = initial_markets
|
type(api_mock).markets = initial_markets
|
||||||
default_conf['exchange']['markets_refresh_interval'] = 10
|
default_conf['exchange']['markets_refresh_interval'] = 10
|
||||||
exchange = get_patched_exchange(mocker, default_conf, api_mock, id="binance")
|
exchange = get_patched_exchange(mocker, default_conf, api_mock, id="binance")
|
||||||
exchange._last_markets_refresh = arrow.utcnow().timestamp
|
exchange._last_markets_refresh = arrow.utcnow().timestamp
|
||||||
updated_markets = {'ETH/BTC': {}, "LTC/BTC": {}}
|
updated_markets = {'ETH/BTC': {}, "LTC/BTC": {}}
|
||||||
|
|
||||||
def _load_markets(*args, **kwargs):
|
|
||||||
exchange._api.markets = updated_markets
|
|
||||||
|
|
||||||
mocker.patch('freqtrade.exchange.Exchange._load_markets', _load_markets)
|
|
||||||
assert exchange.markets == initial_markets
|
assert exchange.markets == initial_markets
|
||||||
|
|
||||||
# less than 10 minutes have passed, no reload
|
# less than 10 minutes have passed, no reload
|
||||||
|
Loading…
Reference in New Issue
Block a user