Fix some test-types
This commit is contained in:
parent
cc0a733f1f
commit
a3415e52c0
@ -697,8 +697,8 @@ def test_rpcforcebuy(mocker, default_conf, ticker, fee, limit_buy_order) -> None
|
||||
pair = 'XRP/BTC'
|
||||
|
||||
# Test not buying
|
||||
default_conf['stake_amount'] = 0.0000001
|
||||
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
|
||||
freqtradebot.config['stake_amount'] = 0.0000001
|
||||
patch_get_signal(freqtradebot, (True, False))
|
||||
rpc = RPC(freqtradebot)
|
||||
pair = 'TKN/BTC'
|
||||
|
@ -23,7 +23,7 @@ _TEST_PASS = "SuperSecurePassword1!"
|
||||
def botclient(default_conf, mocker):
|
||||
default_conf.update({"api_server": {"enabled": True,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": "8080",
|
||||
"listen_port": 8080,
|
||||
"username": _TEST_USER,
|
||||
"password": _TEST_PASS,
|
||||
}})
|
||||
@ -133,7 +133,10 @@ def test_api__init__(default_conf, mocker):
|
||||
def test_api_run(default_conf, mocker, caplog):
|
||||
default_conf.update({"api_server": {"enabled": True,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": "8080"}})
|
||||
"listen_port": 8080,
|
||||
"username": "TestUser",
|
||||
"password": "testPass",
|
||||
}})
|
||||
mocker.patch('freqtrade.rpc.telegram.Updater', MagicMock())
|
||||
mocker.patch('freqtrade.rpc.api_server.threading.Thread', MagicMock())
|
||||
|
||||
@ -146,7 +149,7 @@ def test_api_run(default_conf, mocker, caplog):
|
||||
apiserver.run()
|
||||
assert server_mock.call_count == 1
|
||||
assert server_mock.call_args_list[0][0][0] == "127.0.0.1"
|
||||
assert server_mock.call_args_list[0][0][1] == "8080"
|
||||
assert server_mock.call_args_list[0][0][1] == 8080
|
||||
assert isinstance(server_mock.call_args_list[0][0][2], Flask)
|
||||
assert hasattr(apiserver, "srv")
|
||||
|
||||
@ -158,14 +161,14 @@ def test_api_run(default_conf, mocker, caplog):
|
||||
server_mock.reset_mock()
|
||||
apiserver._config.update({"api_server": {"enabled": True,
|
||||
"listen_ip_address": "0.0.0.0",
|
||||
"listen_port": "8089",
|
||||
"listen_port": 8089,
|
||||
"password": "",
|
||||
}})
|
||||
apiserver.run()
|
||||
|
||||
assert server_mock.call_count == 1
|
||||
assert server_mock.call_args_list[0][0][0] == "0.0.0.0"
|
||||
assert server_mock.call_args_list[0][0][1] == "8089"
|
||||
assert server_mock.call_args_list[0][0][1] == 8089
|
||||
assert isinstance(server_mock.call_args_list[0][0][2], Flask)
|
||||
assert log_has("Starting HTTP Server at 0.0.0.0:8089", caplog)
|
||||
assert log_has("Starting Local Rest Server.", caplog)
|
||||
@ -186,7 +189,10 @@ def test_api_run(default_conf, mocker, caplog):
|
||||
def test_api_cleanup(default_conf, mocker, caplog):
|
||||
default_conf.update({"api_server": {"enabled": True,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": "8080"}})
|
||||
"listen_port": 8080,
|
||||
"username": "TestUser",
|
||||
"password": "testPass",
|
||||
}})
|
||||
mocker.patch('freqtrade.rpc.telegram.Updater', MagicMock())
|
||||
mocker.patch('freqtrade.rpc.api_server.threading.Thread', MagicMock())
|
||||
mocker.patch('freqtrade.rpc.api_server.make_server', MagicMock())
|
||||
|
@ -173,7 +173,10 @@ def test_init_apiserver_enabled(mocker, default_conf, caplog) -> None:
|
||||
default_conf["telegram"]["enabled"] = False
|
||||
default_conf["api_server"] = {"enabled": True,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": "8080"}
|
||||
"listen_port": 8080,
|
||||
"username": "TestUser",
|
||||
"password": "TestPass",
|
||||
}
|
||||
rpc_manager = RPCManager(get_patched_freqtradebot(mocker, default_conf))
|
||||
|
||||
# Sleep to allow the thread to start
|
||||
|
@ -144,9 +144,9 @@ def test_authorized_only_exception(default_conf, mocker, caplog) -> None:
|
||||
|
||||
|
||||
def test_status(default_conf, update, mocker, fee, ticker,) -> None:
|
||||
update.message.chat.id = 123
|
||||
update.message.chat.id = "123"
|
||||
default_conf['telegram']['enabled'] = False
|
||||
default_conf['telegram']['chat_id'] = 123
|
||||
default_conf['telegram']['chat_id'] = "123"
|
||||
|
||||
mocker.patch.multiple(
|
||||
'freqtrade.exchange.Exchange',
|
||||
|
@ -113,7 +113,7 @@ def test_send_msg(default_conf, mocker):
|
||||
|
||||
def test_exception_send_msg(default_conf, mocker, caplog):
|
||||
default_conf["webhook"] = get_webhook_dict()
|
||||
default_conf["webhook"]["webhookbuy"] = None
|
||||
del default_conf["webhook"]["webhookbuy"]
|
||||
|
||||
webhook = Webhook(get_patched_freqtradebot(mocker, default_conf))
|
||||
webhook.send_msg({'type': RPCMessageType.BUY_NOTIFICATION})
|
||||
|
@ -299,7 +299,7 @@ def test_total_open_trades_stakes(mocker, default_conf, ticker,
|
||||
limit_buy_order, fee) -> None:
|
||||
patch_RPCManager(mocker)
|
||||
patch_exchange(mocker)
|
||||
default_conf['stake_amount'] = 0.0000098751
|
||||
default_conf['stake_amount'] = 0.0098751
|
||||
default_conf['max_open_trades'] = 2
|
||||
mocker.patch.multiple(
|
||||
'freqtrade.exchange.Exchange',
|
||||
@ -313,7 +313,7 @@ def test_total_open_trades_stakes(mocker, default_conf, ticker,
|
||||
trade = Trade.query.first()
|
||||
|
||||
assert trade is not None
|
||||
assert trade.stake_amount == 0.0000098751
|
||||
assert trade.stake_amount == 0.0098751
|
||||
assert trade.is_open
|
||||
assert trade.open_date is not None
|
||||
|
||||
@ -321,11 +321,11 @@ def test_total_open_trades_stakes(mocker, default_conf, ticker,
|
||||
trade = Trade.query.order_by(Trade.id.desc()).first()
|
||||
|
||||
assert trade is not None
|
||||
assert trade.stake_amount == 0.0000098751
|
||||
assert trade.stake_amount == 0.0098751
|
||||
assert trade.is_open
|
||||
assert trade.open_date is not None
|
||||
|
||||
assert Trade.total_open_trades_stakes() == 1.97502e-05
|
||||
assert Trade.total_open_trades_stakes() == 1.97502e-02
|
||||
|
||||
|
||||
def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
|
||||
@ -522,8 +522,9 @@ def test_create_trades_too_small_stake_amount(default_conf, ticker, limit_buy_or
|
||||
get_fee=fee,
|
||||
)
|
||||
|
||||
default_conf['stake_amount'] = 0.000000005
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
freqtrade.config['stake_amount'] = 0.000000005
|
||||
|
||||
patch_get_signal(freqtrade)
|
||||
|
||||
assert not freqtrade.create_trades()
|
||||
|
Loading…
Reference in New Issue
Block a user