-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract build-config tests to new file
- Loading branch information
Showing
2 changed files
with
44 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import json | ||
from pathlib import Path | ||
from unittest.mock import MagicMock | ||
|
||
import pytest | ||
|
||
from freqtrade.commands import start_new_config | ||
from tests.conftest import get_args, log_has_re | ||
|
||
|
||
@pytest.mark.parametrize('exchange', ['bittrex', 'binance', 'kraken', 'ftx']) | ||
def test_start_new_config(mocker, caplog, exchange): | ||
wt_mock = mocker.patch.object(Path, "write_text", MagicMock()) | ||
mocker.patch.object(Path, "exists", MagicMock(return_value=False)) | ||
sample_selections = { | ||
'max_open_trades': 3, | ||
'stake_currency': 'USDT', | ||
'stake_amount': 100, | ||
'fiat_display_currency': 'EUR', | ||
'ticker_interval': '15m', | ||
'dry_run': True, | ||
'exchange_name': exchange, | ||
'exchange_key': 'sampleKey', | ||
'exchange_secret': 'Samplesecret', | ||
'telegram': False, | ||
'telegram_token': 'asdf1244', | ||
'telegram_chat_id': '1144444', | ||
} | ||
mocker.patch('freqtrade.commands.build_config_commands.ask_user_config', | ||
return_value=sample_selections) | ||
args = [ | ||
"new-config", | ||
"--config", | ||
"coolconfig.json" | ||
] | ||
start_new_config(get_args(args)) | ||
|
||
assert log_has_re("Writing config to .*", caplog) | ||
assert wt_mock.call_count == 1 | ||
result = json.loads(wt_mock.call_args_list[0][0][0]) | ||
assert result['exchange']['name'] == exchange | ||
assert result['ticker_interval'] == '15m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters