Add better test scenario
This commit is contained in:
parent
31cce741ac
commit
044afdf7af
@ -150,7 +150,6 @@ class Configuration:
|
|||||||
self._args_to_config(config, argname='db_url_from',
|
self._args_to_config(config, argname='db_url_from',
|
||||||
logstring='Parameter --db-url-from detected ...')
|
logstring='Parameter --db-url-from detected ...')
|
||||||
|
|
||||||
|
|
||||||
if config.get('force_entry_enable', False):
|
if config.get('force_entry_enable', False):
|
||||||
logger.warning('`force_entry_enable` RPC message enabled.')
|
logger.warning('`force_entry_enable` RPC message enabled.')
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
from datetime import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest.mock import MagicMock, PropertyMock
|
from unittest.mock import MagicMock, PropertyMock
|
||||||
@ -21,6 +22,7 @@ from freqtrade.configuration import setup_utils_configuration
|
|||||||
from freqtrade.enums import RunMode
|
from freqtrade.enums import RunMode
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.persistence.models import init_db
|
from freqtrade.persistence.models import init_db
|
||||||
|
from freqtrade.persistence.pairlock_middleware import PairLocks
|
||||||
from tests.conftest import (CURRENT_TEST_STRATEGY, create_mock_trades, get_args, log_has,
|
from tests.conftest import (CURRENT_TEST_STRATEGY, create_mock_trades, get_args, log_has,
|
||||||
log_has_re, patch_exchange, patched_configuration_load_config_file)
|
log_has_re, patch_exchange, patched_configuration_load_config_file)
|
||||||
from tests.conftest_trades import MOCK_TRADE_COUNT
|
from tests.conftest_trades import MOCK_TRADE_COUNT
|
||||||
@ -1479,9 +1481,14 @@ def test_start_convert_db(mocker, fee, tmpdir, caplog):
|
|||||||
init_db(db_from, False)
|
init_db(db_from, False)
|
||||||
|
|
||||||
create_mock_trades(fee)
|
create_mock_trades(fee)
|
||||||
|
|
||||||
|
PairLocks.timeframe = '5m'
|
||||||
|
PairLocks.lock_pair('XRP/USDT', datetime.now(), 'Random reason 125', side='long')
|
||||||
assert db_src_file.is_file()
|
assert db_src_file.is_file()
|
||||||
assert not db_target_file.is_file()
|
assert not db_target_file.is_file()
|
||||||
|
|
||||||
pargs = get_args(args)
|
pargs = get_args(args)
|
||||||
pargs['config'] = None
|
pargs['config'] = None
|
||||||
start_convert_db(pargs)
|
start_convert_db(pargs)
|
||||||
|
|
||||||
assert db_target_file.is_file()
|
assert db_target_file.is_file()
|
||||||
|
@ -1416,14 +1416,14 @@ def test_migrate_set_sequence_ids():
|
|||||||
engine = MagicMock()
|
engine = MagicMock()
|
||||||
engine.begin = MagicMock()
|
engine.begin = MagicMock()
|
||||||
engine.name = 'postgresql'
|
engine.name = 'postgresql'
|
||||||
set_sequence_ids(engine, 22, 55)
|
set_sequence_ids(engine, 22, 55, 5)
|
||||||
|
|
||||||
assert engine.begin.call_count == 1
|
assert engine.begin.call_count == 1
|
||||||
engine.reset_mock()
|
engine.reset_mock()
|
||||||
engine.begin.reset_mock()
|
engine.begin.reset_mock()
|
||||||
|
|
||||||
engine.name = 'somethingelse'
|
engine.name = 'somethingelse'
|
||||||
set_sequence_ids(engine, 22, 55)
|
set_sequence_ids(engine, 22, 55, 6)
|
||||||
|
|
||||||
assert engine.begin.call_count == 0
|
assert engine.begin.call_count == 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user