2019-06-16 18:37:59 +00:00
|
|
|
from freqtrade.utils import setup_utils_configuration, start_list_exchanges
|
2019-06-16 08:13:56 +00:00
|
|
|
from freqtrade.tests.conftest import get_args
|
2019-06-16 08:13:24 +00:00
|
|
|
from freqtrade.state import RunMode
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
2019-06-16 18:37:59 +00:00
|
|
|
def test_setup_utils_configuration():
|
2019-06-16 08:13:24 +00:00
|
|
|
args = [
|
|
|
|
'--config', 'config.json.example',
|
|
|
|
]
|
|
|
|
|
2019-06-16 18:37:59 +00:00
|
|
|
config = setup_utils_configuration(get_args(args), RunMode.OTHER)
|
2019-06-16 08:13:24 +00:00
|
|
|
assert "exchange" in config
|
2019-06-16 18:37:59 +00:00
|
|
|
assert config['exchange']['dry_run'] is True
|
2019-06-16 08:13:24 +00:00
|
|
|
assert config['exchange']['key'] == ''
|
|
|
|
assert config['exchange']['secret'] == ''
|
|
|
|
|
|
|
|
|
|
|
|
def test_list_exchanges(capsys):
|
|
|
|
|
|
|
|
args = [
|
|
|
|
"list-exchanges",
|
|
|
|
]
|
|
|
|
|
|
|
|
start_list_exchanges(get_args(args))
|
|
|
|
captured = capsys.readouterr()
|
|
|
|
assert re.match(r"Exchanges supported by ccxt and available.*", captured.out)
|
|
|
|
assert re.match(r".*binance,.*", captured.out)
|
|
|
|
assert re.match(r".*bittrex,.*", captured.out)
|
|
|
|
|
|
|
|
# Test with --one-column
|
|
|
|
args = [
|
|
|
|
"list-exchanges",
|
|
|
|
"--one-column",
|
|
|
|
]
|
|
|
|
|
|
|
|
start_list_exchanges(get_args(args))
|
|
|
|
captured = capsys.readouterr()
|
|
|
|
assert not re.match(r"Exchanges supported by ccxt and available.*", captured.out)
|
|
|
|
assert re.search(r"^binance$", captured.out, re.MULTILINE)
|
|
|
|
assert re.search(r"^bittrex$", captured.out, re.MULTILINE)
|