use dict as argument for rpc.send_msg

This commit is contained in:
gcarq
2018-06-25 00:04:27 +02:00
parent 96a405feb7
commit 4cb1aa1d97
8 changed files with 89 additions and 68 deletions

View File

@@ -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

View File

@@ -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: