Make test exchange-independent

This commit is contained in:
Matthias 2019-10-06 10:32:19 +02:00
parent f95b0ccdab
commit d2589c4415

View File

@ -49,8 +49,16 @@ def test_list_exchanges(capsys):
assert re.search(r"^bittrex$", captured.out, re.MULTILINE)
def test_list_timeframes(capsys):
def test_list_timeframes(mocker, capsys):
api_mock = MagicMock()
api_mock.timeframes = {'1m': '1m',
'5m': '5m',
'30m': '30m',
'1h': '1h',
'1d': '1d',
}
patch_exchange(mocker, api_mock=api_mock)
args = [
"list-timeframes",
]
@ -82,6 +90,17 @@ def test_list_timeframes(capsys):
"1m, 5m, 30m, 1h, 1d",
captured.out)
api_mock.timeframes = {'1m': '1m',
'5m': '5m',
'15m': '15m',
'30m': '30m',
'1h': '1h',
'6h': '6h',
'12h': '12h',
'1d': '1d',
'3d': '3d',
}
patch_exchange(mocker, api_mock=api_mock)
# Test with --exchange binance
args = [
"list-timeframes",
@ -90,7 +109,7 @@ def test_list_timeframes(capsys):
start_list_timeframes(get_args(args))
captured = capsys.readouterr()
assert re.match("Timeframes available for the exchange `binance`: "
"1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M",
"1m, 5m, 15m, 30m, 1h, 6h, 12h, 1d, 3d",
captured.out)
# Test with --one-column