use dict as argument for rpc.send_msg
This commit is contained in:
@@ -102,9 +102,9 @@ def test_send_msg_telegram_disabled(mocker, default_conf, caplog) -> None:
|
||||
|
||||
freqtradebot = get_patched_freqtradebot(mocker, conf)
|
||||
rpc_manager = RPCManager(freqtradebot)
|
||||
rpc_manager.send_msg('test')
|
||||
rpc_manager.send_msg({'status': 'test'})
|
||||
|
||||
assert log_has('Sending rpc message: test', caplog.record_tuples)
|
||||
assert log_has("Sending rpc message: {'status': 'test'}", caplog.record_tuples)
|
||||
assert telegram_mock.call_count == 0
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ def test_send_msg_telegram_enabled(mocker, default_conf, caplog) -> None:
|
||||
|
||||
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
|
||||
rpc_manager = RPCManager(freqtradebot)
|
||||
rpc_manager.send_msg('test')
|
||||
rpc_manager.send_msg({'status': 'test'})
|
||||
|
||||
assert log_has('Sending rpc message: test', caplog.record_tuples)
|
||||
assert log_has("Sending rpc message: {'status': 'test'}", caplog.record_tuples)
|
||||
assert telegram_mock.call_count == 1
|
||||
|
@@ -757,12 +757,13 @@ def test_forcesell_handle(default_conf, update, ticker, fee,
|
||||
telegram._forcesell(bot=MagicMock(), update=update)
|
||||
|
||||
assert rpc_mock.call_count == 2
|
||||
assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '0.00001172' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'profit: 6.11%, 0.00006126' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '0.919 USD' in rpc_mock.call_args_list[-1][0][0]
|
||||
last_call = rpc_mock.call_args_list[-1][0][0]['status']
|
||||
assert 'Selling' in last_call
|
||||
assert '[ETH/BTC]' in last_call
|
||||
assert 'Amount' in last_call
|
||||
assert '0.00001172' in last_call
|
||||
assert 'profit: 6.11%, 0.00006126' in last_call
|
||||
assert '0.919 USD' in last_call
|
||||
|
||||
|
||||
def test_forcesell_down_handle(default_conf, update, ticker, fee,
|
||||
@@ -802,13 +803,14 @@ def test_forcesell_down_handle(default_conf, update, ticker, fee,
|
||||
update.message.text = '/forcesell 1'
|
||||
telegram._forcesell(bot=MagicMock(), update=update)
|
||||
|
||||
last_call = rpc_mock.call_args_list[-1][0][0]['status']
|
||||
assert rpc_mock.call_count == 2
|
||||
assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '0.00001044' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '-0.824 USD' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'Selling' in last_call
|
||||
assert '[ETH/BTC]' in last_call
|
||||
assert 'Amount' in last_call
|
||||
assert '0.00001044' in last_call
|
||||
assert 'loss: -5.48%, -0.00005492' in last_call
|
||||
assert '-0.824 USD' in last_call
|
||||
|
||||
|
||||
def test_forcesell_all_handle(default_conf, update, ticker, fee, markets, mocker) -> None:
|
||||
@@ -842,9 +844,9 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, markets, mocker
|
||||
|
||||
assert rpc_mock.call_count == 4
|
||||
for args in rpc_mock.call_args_list:
|
||||
assert '0.00001098' in args[0][0]
|
||||
assert 'loss: -0.59%, -0.00000591 BTC' in args[0][0]
|
||||
assert '-0.089 USD' in args[0][0]
|
||||
assert '0.00001098' in args[0][0]['status']
|
||||
assert 'loss: -0.59%, -0.00000591 BTC' in args[0][0]['status']
|
||||
assert '-0.089 USD' in args[0][0]['status']
|
||||
|
||||
|
||||
def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
|
||||
|
@@ -755,7 +755,7 @@ def test_process_operational_exception(default_conf, ticker, markets, mocker) ->
|
||||
result = freqtrade._process()
|
||||
assert result is False
|
||||
assert freqtrade.state == State.STOPPED
|
||||
assert 'OperationalException' in msg_mock.call_args_list[-1][0][0]
|
||||
assert 'OperationalException' in msg_mock.call_args_list[-1][0][0]['status']
|
||||
|
||||
|
||||
def test_process_trade_handling(
|
||||
@@ -1375,13 +1375,14 @@ def test_execute_sell_up(default_conf, ticker, fee, ticker_sell_up, markets, moc
|
||||
freqtrade.execute_sell(trade=trade, limit=ticker_sell_up()['bid'])
|
||||
|
||||
assert rpc_mock.call_count == 2
|
||||
assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'Profit' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '0.00001172' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'profit: 6.11%, 0.00006126' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '0.919 USD' in rpc_mock.call_args_list[-1][0][0]
|
||||
last_call = rpc_mock.call_args_list[-1][0][0]['status']
|
||||
assert 'Selling' in last_call
|
||||
assert '[ETH/BTC]' in last_call
|
||||
assert 'Amount' in last_call
|
||||
assert 'Profit' in last_call
|
||||
assert '0.00001172' in last_call
|
||||
assert 'profit: 6.11%, 0.00006126' in last_call
|
||||
assert '0.919 USD' in last_call
|
||||
|
||||
|
||||
def test_execute_sell_down(default_conf, ticker, fee, ticker_sell_down, markets, mocker) -> None:
|
||||
@@ -1417,12 +1418,13 @@ def test_execute_sell_down(default_conf, ticker, fee, ticker_sell_down, markets,
|
||||
freqtrade.execute_sell(trade=trade, limit=ticker_sell_down()['bid'])
|
||||
|
||||
assert rpc_mock.call_count == 2
|
||||
assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '0.00001044' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '-0.824 USD' in rpc_mock.call_args_list[-1][0][0]
|
||||
last_call = rpc_mock.call_args_list[-1][0][0]['status']
|
||||
assert 'Selling' in last_call
|
||||
assert '[ETH/BTC]' in last_call
|
||||
assert 'Amount' in last_call
|
||||
assert '0.00001044' in last_call
|
||||
assert 'loss: -5.48%, -0.00005492' in last_call
|
||||
assert '-0.824 USD' in last_call
|
||||
|
||||
|
||||
def test_execute_sell_without_conf_sell_up(default_conf, ticker, fee,
|
||||
@@ -1459,12 +1461,13 @@ def test_execute_sell_without_conf_sell_up(default_conf, ticker, fee,
|
||||
freqtrade.execute_sell(trade=trade, limit=ticker_sell_up()['bid'])
|
||||
|
||||
assert rpc_mock.call_count == 2
|
||||
assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'Amount' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '0.00001172' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '(profit: 6.11%, 0.00006126)' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'USD' not in rpc_mock.call_args_list[-1][0][0]
|
||||
last_call = rpc_mock.call_args_list[-1][0][0]['status']
|
||||
assert 'Selling' in last_call
|
||||
assert '[ETH/BTC]' in last_call
|
||||
assert 'Amount' in last_call
|
||||
assert '0.00001172' in last_call
|
||||
assert '(profit: 6.11%, 0.00006126)' in last_call
|
||||
assert 'USD' not in last_call
|
||||
|
||||
|
||||
def test_execute_sell_without_conf_sell_down(default_conf, ticker, fee,
|
||||
@@ -1501,10 +1504,11 @@ def test_execute_sell_without_conf_sell_down(default_conf, ticker, fee,
|
||||
freqtrade.execute_sell(trade=trade, limit=ticker_sell_down()['bid'])
|
||||
|
||||
assert rpc_mock.call_count == 2
|
||||
assert 'Selling' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '[ETH/BTC]' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert '0.00001044' in rpc_mock.call_args_list[-1][0][0]
|
||||
assert 'loss: -5.48%, -0.00005492' in rpc_mock.call_args_list[-1][0][0]
|
||||
last_call = rpc_mock.call_args_list[-1][0][0]['status']
|
||||
assert 'Selling' in last_call
|
||||
assert '[ETH/BTC]' in last_call
|
||||
assert '0.00001044' in last_call
|
||||
assert 'loss: -5.48%, -0.00005492' in last_call
|
||||
|
||||
|
||||
def test_sell_profit_only_enable_profit(default_conf, limit_buy_order,
|
||||
|
Reference in New Issue
Block a user