To better align with multiple client protocols, this PR
Refactors the existing RPC directory, classes, defs as below. This is to better reflect the nature of the files/classes/defs to support other clients - such as rest The code is functional, ive tested every RPC button in Telegram. 1 unit test is failing ( they all were till find_replace) in test_rpc_telegram. Can I ask for anothers opinion on why this 1 test fails, im at loss to debug - mocker is stretching my working knowledge of python - Ive renamed common methods from RPC_method_name to server_method_name e.g rpc_stop becomes server_stop, the super class is CLIENTS not RPC as it is agnostic to RPC freqtrade/rcp/ - rpc.py ......................- rpc_manager.py ......................- telegram.py to: freqtrade/clients/client_manager.py (was rpc_manager ......................-common/client.py (was rpc.py - but is agnostic to what client calls) ......................-rpc/telegram.py ......................-rpc/*discord.py (example future RPC client ......................-rest/*cmd line.py (example future rest cmdline rest client ......................-rest/*web.py (example future rest web client
This commit is contained in:
@@ -30,7 +30,7 @@ def get_patched_freqtradebot(mocker, config) -> FreqtradeBot:
|
||||
:return: None
|
||||
"""
|
||||
mocker.patch('freqtrade.freqtradebot.Analyze', MagicMock())
|
||||
mocker.patch('freqtrade.freqtradebot.RPCManager', MagicMock())
|
||||
mocker.patch('freqtrade.freqtradebot.ClientManager', MagicMock())
|
||||
mocker.patch('freqtrade.freqtradebot.persistence.init', MagicMock())
|
||||
mocker.patch('freqtrade.freqtradebot.exchange.init', MagicMock())
|
||||
patch_coinmarketcap(mocker)
|
||||
@@ -53,12 +53,12 @@ def patch_get_signal(mocker, value=(True, False)) -> None:
|
||||
|
||||
def patch_RPCManager(mocker) -> MagicMock:
|
||||
"""
|
||||
This function mock RPC manager to avoid repeating this code in almost every tests
|
||||
:param mocker: mocker to patch RPCManager class
|
||||
:return: RPCManager.send_msg MagicMock to track if this method is called
|
||||
This function mock CLIENT manager to avoid repeating this code in almost every tests
|
||||
:param mocker: mocker to patch ClientManager class
|
||||
:return: ClientManager.send_msg MagicMock to track if this method is called
|
||||
"""
|
||||
mocker.patch('freqtrade.freqtradebot.RPCManager._init', MagicMock())
|
||||
rpc_mock = mocker.patch('freqtrade.freqtradebot.RPCManager.send_msg', MagicMock())
|
||||
mocker.patch('freqtrade.freqtradebot.ClientManager._init', MagicMock())
|
||||
rpc_mock = mocker.patch('freqtrade.freqtradebot.ClientManager.send_msg', MagicMock())
|
||||
return rpc_mock
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user