Merge commit '4dca84817eb1b62047a9e4d282254392ea978e44' into feature/objectify

This commit is contained in:
Gerald Lonlas
2018-03-04 02:06:40 -08:00
16 changed files with 133 additions and 153 deletions

View File

@@ -11,7 +11,7 @@ from jsonschema import ValidationError
from freqtrade.arguments import Arguments
from freqtrade.configuration import Configuration
import freqtrade.tests.conftest as tt # test tools
from freqtrade.tests.conftest import log_has
def test_configuration_object() -> None:
@@ -64,7 +64,7 @@ def test_load_config_file(default_conf, mocker, caplog) -> None:
assert file_mock.call_count == 1
assert validated_conf.items() >= default_conf.items()
assert 'internals' in validated_conf
assert tt.log_has('Validating configuration ...', caplog.record_tuples)
assert log_has('Validating configuration ...', caplog.record_tuples)
def test_load_config(default_conf, mocker) -> None:
@@ -129,19 +129,19 @@ def test_show_info(default_conf, mocker, caplog) -> None:
configuration = Configuration(args)
configuration.get_config()
assert tt.log_has(
assert log_has(
'Parameter --dynamic-whitelist detected. '
'Using dynamically generated whitelist. '
'(not applicable with Backtesting and Hyperopt)',
caplog.record_tuples
)
assert tt.log_has(
assert log_has(
'Parameter --dry-run-db detected ...',
caplog.record_tuples
)
assert tt.log_has(
assert log_has(
'Dry_run will use the DB file: "tradesv3.dry_run.sqlite"',
caplog.record_tuples
)
@@ -149,7 +149,7 @@ def test_show_info(default_conf, mocker, caplog) -> None:
# Test the Dry run condition
configuration.config.update({'dry_run': False})
configuration._load_common_config(configuration.config)
assert tt.log_has(
assert log_has(
'Dry run is disabled. (--dry_run_db ignored)',
caplog.record_tuples
)
@@ -179,21 +179,21 @@ def test_setup_configuration_without_arguments(mocker, default_conf, caplog) ->
assert 'exchange' in config
assert 'pair_whitelist' in config['exchange']
assert 'datadir' in config
assert tt.log_has(
assert log_has(
'Parameter --datadir detected: {} ...'.format(config['datadir']),
caplog.record_tuples
)
assert 'ticker_interval' in config
assert not tt.log_has('Parameter -i/--ticker-interval detected ...', caplog.record_tuples)
assert not log_has('Parameter -i/--ticker-interval detected ...', caplog.record_tuples)
assert 'live' not in config
assert not tt.log_has('Parameter -l/--live detected ...', caplog.record_tuples)
assert not log_has('Parameter -l/--live detected ...', caplog.record_tuples)
assert 'realistic_simulation' not in config
assert not tt.log_has('Parameter --realistic-simulation detected ...', caplog.record_tuples)
assert not log_has('Parameter --realistic-simulation detected ...', caplog.record_tuples)
assert 'refresh_pairs' not in config
assert not tt.log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
assert not log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
assert 'timerange' not in config
assert 'export' not in config
@@ -230,34 +230,34 @@ def test_setup_configuration_with_arguments(mocker, default_conf, caplog) -> Non
assert 'exchange' in config
assert 'pair_whitelist' in config['exchange']
assert 'datadir' in config
assert tt.log_has(
assert log_has(
'Parameter --datadir detected: {} ...'.format(config['datadir']),
caplog.record_tuples
)
assert 'ticker_interval' in config
assert tt.log_has('Parameter -i/--ticker-interval detected ...', caplog.record_tuples)
assert tt.log_has(
assert log_has('Parameter -i/--ticker-interval detected ...', caplog.record_tuples)
assert log_has(
'Using ticker_interval: 1 ...',
caplog.record_tuples
)
assert 'live' in config
assert tt.log_has('Parameter -l/--live detected ...', caplog.record_tuples)
assert log_has('Parameter -l/--live detected ...', caplog.record_tuples)
assert 'realistic_simulation'in config
assert tt.log_has('Parameter --realistic-simulation detected ...', caplog.record_tuples)
assert tt.log_has('Using max_open_trades: 1 ...', caplog.record_tuples)
assert log_has('Parameter --realistic-simulation detected ...', caplog.record_tuples)
assert log_has('Using max_open_trades: 1 ...', caplog.record_tuples)
assert 'refresh_pairs'in config
assert tt.log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
assert log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
assert 'timerange' in config
assert tt.log_has(
assert log_has(
'Parameter --timerange detected: {} ...'.format(config['timerange']),
caplog.record_tuples
)
assert 'export' in config
assert tt.log_has(
assert log_has(
'Parameter --export detected: {} ...'.format(config['export']),
caplog.record_tuples
)
@@ -282,4 +282,4 @@ def test_hyperopt_space_argument(mocker, default_conf, caplog) -> None:
config = configuration.get_config()
assert 'spaces' in config
assert config['spaces'] == ['all']
assert tt.log_has('Parameter -s/--spaces detected: [\'all\']', caplog.record_tuples)
assert log_has('Parameter -s/--spaces detected: [\'all\']', caplog.record_tuples)