flake 8
This commit is contained in:
parent
fc06d028b8
commit
1e804c0df5
@ -114,7 +114,8 @@ class Exchange(object):
|
|||||||
if api.urls.get('test'):
|
if api.urls.get('test'):
|
||||||
api.urls['api'] = api.urls['test']
|
api.urls['api'] = api.urls['test']
|
||||||
else:
|
else:
|
||||||
logger.warning(self, "No Sandbox URL in CCXT, exiting. Please check your config.json")
|
logger.warning(self, "No Sandbox URL in CCXT, exiting. "
|
||||||
|
"Please check your config.json")
|
||||||
raise OperationalException(f'Exchange {name} does not provide a sandbox api')
|
raise OperationalException(f'Exchange {name} does not provide a sandbox api')
|
||||||
|
|
||||||
def validate_pairs(self, pairs: List[str]) -> None:
|
def validate_pairs(self, pairs: List[str]) -> None:
|
||||||
|
@ -51,6 +51,7 @@ def test_init_exception(default_conf, mocker):
|
|||||||
mocker.patch("ccxt.binance", MagicMock(side_effect=AttributeError))
|
mocker.patch("ccxt.binance", MagicMock(side_effect=AttributeError))
|
||||||
Exchange(default_conf)
|
Exchange(default_conf)
|
||||||
|
|
||||||
|
|
||||||
def test_set_sandbox(default_conf, mocker):
|
def test_set_sandbox(default_conf, mocker):
|
||||||
"""
|
"""
|
||||||
Test working scenario
|
Test working scenario
|
||||||
@ -59,7 +60,8 @@ def test_set_sandbox(default_conf, mocker):
|
|||||||
api_mock.load_markets = MagicMock(return_value={
|
api_mock.load_markets = MagicMock(return_value={
|
||||||
'ETH/BTC': '', 'LTC/BTC': '', 'XRP/BTC': '', 'NEO/BTC': ''
|
'ETH/BTC': '', 'LTC/BTC': '', 'XRP/BTC': '', 'NEO/BTC': ''
|
||||||
})
|
})
|
||||||
url_mock = PropertyMock(return_value={'test': "api-public.sandbox.gdax.com", 'api': 'https://api.gdax.com'})
|
url_mock = PropertyMock(return_value={'test': "api-public.sandbox.gdax.com",
|
||||||
|
'api': 'https://api.gdax.com'})
|
||||||
type(api_mock).urls = url_mock
|
type(api_mock).urls = url_mock
|
||||||
mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=api_mock))
|
mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=api_mock))
|
||||||
mocker.patch('freqtrade.exchange.Exchange.validate_timeframes', MagicMock())
|
mocker.patch('freqtrade.exchange.Exchange.validate_timeframes', MagicMock())
|
||||||
@ -70,6 +72,7 @@ def test_set_sandbox(default_conf, mocker):
|
|||||||
exchange.set_sandbox(exchange._api, default_conf['exchange'], 'Logname')
|
exchange.set_sandbox(exchange._api, default_conf['exchange'], 'Logname')
|
||||||
assert exchange._api.urls['api'] != liveurl
|
assert exchange._api.urls['api'] != liveurl
|
||||||
|
|
||||||
|
|
||||||
def test_set_sandbox_exception(default_conf, mocker):
|
def test_set_sandbox_exception(default_conf, mocker):
|
||||||
"""
|
"""
|
||||||
Test Fail scenario
|
Test Fail scenario
|
||||||
@ -88,7 +91,6 @@ def test_set_sandbox_exception(default_conf, mocker):
|
|||||||
exchange = Exchange(default_conf)
|
exchange = Exchange(default_conf)
|
||||||
default_conf['exchange']['sandbox'] = True
|
default_conf['exchange']['sandbox'] = True
|
||||||
exchange.set_sandbox(exchange._api, default_conf['exchange'], 'Logname')
|
exchange.set_sandbox(exchange._api, default_conf['exchange'], 'Logname')
|
||||||
assert exchange._api.urls.get('test') == False
|
|
||||||
|
|
||||||
|
|
||||||
def test_validate_pairs(default_conf, mocker):
|
def test_validate_pairs(default_conf, mocker):
|
||||||
|
Loading…
Reference in New Issue
Block a user