This commit is contained in:
jblestang
2018-02-20 22:59:31 +00:00
committed by GitHub
4 changed files with 16 additions and 13 deletions

View File

@@ -92,7 +92,7 @@ def test_process_trade_creation(default_conf, ticker, limit_buy_order, health, m
assert not trades
result = _process(interval=int(default_conf['ticker_interval']))
assert result is True
assert result == (True, 0)
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
assert len(trades) == 1
@@ -118,7 +118,7 @@ def test_process_exchange_failures(default_conf, ticker, health, mocker):
buy=MagicMock(side_effect=requests.exceptions.RequestException))
init(default_conf, create_engine('sqlite://'))
result = _process(interval=int(default_conf['ticker_interval']))
assert result is False
assert result == (False, 30)
assert sleep_mock.has_calls()
@@ -136,7 +136,7 @@ def test_process_operational_exception(default_conf, ticker, health, mocker):
assert get_state() == State.RUNNING
result = _process(interval=int(default_conf['ticker_interval']))
assert result is False
assert result == (False, 0)
assert get_state() == State.STOPPED
assert 'OperationalException' in msg_mock.call_args_list[-1][0][0]
@@ -156,12 +156,12 @@ def test_process_trade_handling(default_conf, ticker, limit_buy_order, health, m
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
assert not trades
result = _process(interval=int(default_conf['ticker_interval']))
assert result is True
assert result == (True, 0)
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
assert len(trades) == 1
result = _process(interval=int(default_conf['ticker_interval']))
assert result is False
assert result == (False, 0)
def test_create_trade(default_conf, ticker, limit_buy_order, mocker):

View File

@@ -16,7 +16,7 @@ from freqtrade.misc import (common_args_parser, file_dump_json, load_config,
def test_throttle():
def func():
return 42
return (42, 1)
start = time.time()
result = throttle(func, min_secs=0.1)
@@ -32,7 +32,7 @@ def test_throttle():
def test_throttle_with_assets():
def func(nb_assets=-1):
return nb_assets
return (nb_assets, 0)
result = throttle(func, min_secs=0.1, nb_assets=666)
assert result == 666