def test_market(mocker, default_conf, markets): api_mock = MagicMock() api_mock.markets = markets exchange = get_patched_exchange(mocker, default_conf, api_mock=api_mock) dp = DataProvider(default_conf, exchange) res = dp.market('ETH/BTC') assert type(res) is dict assert 'symbol' in res assert res['symbol'] == 'ETH/BTC' res = dp.market('UNITTEST/BTC') assert res is None
def test_no_exchange_mode(default_conf): dp = DataProvider(default_conf, None) message = "Exchange is not available to DataProvider." with pytest.raises(OperationalException, match=message): dp.refresh([()]) with pytest.raises(OperationalException, match=message): dp.ohlcv('XRP/USDT', '5m') with pytest.raises(OperationalException, match=message): dp.market('XRP/USDT') with pytest.raises(OperationalException, match=message): dp.ticker('XRP/USDT') with pytest.raises(OperationalException, match=message): dp.orderbook('XRP/USDT', 20) with pytest.raises(OperationalException, match=message): dp.available_pairs()