Remove queue import

Improve tests
This commit is contained in:
Matthias
2020-08-14 20:12:59 +02:00
parent c4f78203ab
commit 9659e516c8
3 changed files with 27 additions and 5 deletions

View File

@@ -447,6 +447,14 @@ def test_api_logs(botclient):
assert isinstance(rc.json['logs'][0][3], str)
assert isinstance(rc.json['logs'][0][4], str)
rc = client_get(client, f"{BASE_URI}/logs?limit=5")
assert_response(rc)
assert len(rc.json) == 2
assert 'logs' in rc.json
# Using a fixed comparison here would make this test fail!
assert rc.json['log_count'] == 5
assert len(rc.json['logs']) == rc.json['log_count']
def test_api_edge_disabled(botclient, mocker, ticker, fee, markets):
ftbot, client = botclient

View File

@@ -1127,6 +1127,21 @@ def test_telegram_logs(default_conf, update, mocker) -> None:
assert "freqtrade.rpc.telegram" in msg_mock.call_args_list[0][0][0]
assert "freqtrade.resolvers.iresolver" in msg_mock.call_args_list[0][0][0]
msg_mock.reset_mock()
context.args = ["1"]
telegram._logs(update=update, context=context)
assert msg_mock.call_count == 1
msg_mock.reset_mock()
# Test with changed MaxMessageLength
mocker.patch('freqtrade.rpc.telegram.MAX_TELEGRAM_MESSAGE_LENGTH', 200)
context = MagicMock()
context.args = []
telegram._logs(update=update, context=context)
# Called at least 3 times. Exact times will change with unrelated changes to setup messages
# Therefore we don't test for this explicitly.
assert msg_mock.call_count > 3
def test_edge_disabled(default_conf, update, mocker) -> None:
msg_mock = MagicMock()