minor apiserver test change

This commit is contained in:
Timothy Pogue 2022-09-08 14:00:22 -06:00
parent 2b9c8550b0
commit c9d4f666c5

View File

@ -51,13 +51,15 @@ def botclient(default_conf, mocker):
ftbot = get_patched_freqtradebot(mocker, default_conf) ftbot = get_patched_freqtradebot(mocker, default_conf)
rpc = RPC(ftbot) rpc = RPC(ftbot)
mocker.patch('freqtrade.rpc.api_server.ApiServer.start_api', MagicMock()) mocker.patch('freqtrade.rpc.api_server.ApiServer.start_api', MagicMock())
apiserver = None
try: try:
apiserver = ApiServer(default_conf) apiserver = ApiServer(default_conf)
apiserver.add_rpc_handler(rpc) apiserver.add_rpc_handler(rpc)
yield ftbot, TestClient(apiserver.app) yield ftbot, TestClient(apiserver.app)
# Cleanup ... ? # Cleanup ... ?
finally: finally:
apiserver.cleanup() if apiserver:
apiserver.cleanup()
ApiServer.shutdown() ApiServer.shutdown()