mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
Add tst for worker termination
This commit is contained in:
parent
6e0655b3b7
commit
91047830fd
|
@ -8,7 +8,8 @@ from freqtrade import OperationalException
|
|||
from freqtrade.state import RunMode
|
||||
from freqtrade.utils import (setup_utils_configuration, start_create_userdir,
|
||||
start_download_data, start_list_exchanges,
|
||||
start_list_markets, start_list_timeframes)
|
||||
start_list_markets, start_list_timeframes,
|
||||
start_trading)
|
||||
from tests.conftest import get_args, log_has, patch_exchange
|
||||
|
||||
|
||||
|
@ -24,6 +25,29 @@ def test_setup_utils_configuration():
|
|||
assert config['exchange']['secret'] == ''
|
||||
|
||||
|
||||
def test_start_trading_fail(mocker):
|
||||
|
||||
mocker.patch("freqtrade.worker.Worker.run", MagicMock(side_effect=OperationalException))
|
||||
|
||||
mocker.patch("freqtrade.worker.Worker.__init__", MagicMock(return_value=None))
|
||||
|
||||
exitmock = mocker.patch("freqtrade.worker.Worker.exit", MagicMock())
|
||||
args = [
|
||||
'trade',
|
||||
'-c', 'config.json.example'
|
||||
]
|
||||
with pytest.raises(OperationalException):
|
||||
start_trading(get_args(args))
|
||||
assert exitmock.call_count == 1
|
||||
|
||||
exitmock.reset_mock()
|
||||
|
||||
mocker.patch("freqtrade.worker.Worker.__init__", MagicMock(side_effect=OperationalException))
|
||||
with pytest.raises(OperationalException):
|
||||
start_trading(get_args(args))
|
||||
assert exitmock.call_count == 0
|
||||
|
||||
|
||||
def test_list_exchanges(capsys):
|
||||
|
||||
args = [
|
||||
|
|
Loading…
Reference in New Issue
Block a user