From 78b81bac48e2fbb5acee8f2f2ca897620b10a929 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Thu, 14 May 2020 16:43:16 +0300 Subject: [PATCH] Add test for dp.ticker() --- tests/data/test_dataprovider.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/data/test_dataprovider.py b/tests/data/test_dataprovider.py index 3e42abb95..32ddfe99e 100644 --- a/tests/data/test_dataprovider.py +++ b/tests/data/test_dataprovider.py @@ -154,6 +154,23 @@ def test_market(mocker, default_conf, markets): assert res is None +def test_ticker(mocker, default_conf, tickers, markets): + api_mock = MagicMock() + api_mock.markets = markets + api_mock.fetch_ticker = MagicMock(side_effect=lambda x: tickers().get(x)) + exchange = get_patched_exchange(mocker, default_conf, api_mock=api_mock) + + dp = DataProvider(default_conf, exchange) + res = dp.ticker('ETH/BTC') + + assert type(res) is dict + assert 'symbol' in res + assert res['symbol'] == 'ETH/BTC' + + res = dp.ticker('UNITTEST/BTC') + assert res == {} + + def test_current_whitelist(mocker, default_conf, tickers): # patch default conf to volumepairlist default_conf['pairlists'][0] = {'method': 'VolumePairList', "number_assets": 5}