Merge pull request #3387 from freqtrade/rpc_blacklist
Improve RPC Blacklist by adding feedback
This commit is contained in:
@@ -848,6 +848,20 @@ def test_rpc_blacklist(mocker, default_conf) -> None:
|
||||
assert ret['blacklist'] == default_conf['exchange']['pair_blacklist']
|
||||
assert ret['blacklist'] == ['DOGE/BTC', 'HOT/BTC', 'ETH/BTC']
|
||||
|
||||
ret = rpc._rpc_blacklist(["ETH/BTC"])
|
||||
assert 'errors' in ret
|
||||
assert isinstance(ret['errors'], dict)
|
||||
assert ret['errors']['ETH/BTC']['error_msg'] == 'Pair ETH/BTC already in pairlist.'
|
||||
|
||||
ret = rpc._rpc_blacklist(["ETH/ETH"])
|
||||
assert 'StaticPairList' in ret['method']
|
||||
assert len(ret['blacklist']) == 3
|
||||
assert ret['blacklist'] == default_conf['exchange']['pair_blacklist']
|
||||
assert ret['blacklist'] == ['DOGE/BTC', 'HOT/BTC', 'ETH/BTC']
|
||||
assert 'errors' in ret
|
||||
assert isinstance(ret['errors'], dict)
|
||||
assert ret['errors']['ETH/ETH']['error_msg'] == 'Pair ETH/ETH does not match stake currency.'
|
||||
|
||||
|
||||
def test_rpc_edge_disabled(mocker, default_conf) -> None:
|
||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||
|
@@ -563,7 +563,9 @@ def test_api_blacklist(botclient, mocker):
|
||||
assert_response(rc)
|
||||
assert rc.json == {"blacklist": ["DOGE/BTC", "HOT/BTC"],
|
||||
"length": 2,
|
||||
"method": ["StaticPairList"]}
|
||||
"method": ["StaticPairList"],
|
||||
"errors": {},
|
||||
}
|
||||
|
||||
# Add ETH/BTC to blacklist
|
||||
rc = client_post(client, f"{BASE_URI}/blacklist",
|
||||
@@ -571,7 +573,9 @@ def test_api_blacklist(botclient, mocker):
|
||||
assert_response(rc)
|
||||
assert rc.json == {"blacklist": ["DOGE/BTC", "HOT/BTC", "ETH/BTC"],
|
||||
"length": 3,
|
||||
"method": ["StaticPairList"]}
|
||||
"method": ["StaticPairList"],
|
||||
"errors": {},
|
||||
}
|
||||
|
||||
|
||||
def test_api_whitelist(botclient):
|
||||
|
@@ -1087,6 +1087,18 @@ def test_blacklist_static(default_conf, update, mocker) -> None:
|
||||
in msg_mock.call_args_list[0][0][0])
|
||||
assert freqtradebot.pairlists.blacklist == ["DOGE/BTC", "HOT/BTC", "ETH/BTC"]
|
||||
|
||||
msg_mock.reset_mock()
|
||||
context = MagicMock()
|
||||
context.args = ["ETH/ETH"]
|
||||
telegram._blacklist(update=update, context=context)
|
||||
assert msg_mock.call_count == 2
|
||||
assert ("Error adding `ETH/ETH` to blacklist: `Pair ETH/ETH does not match stake currency.`"
|
||||
in msg_mock.call_args_list[0][0][0])
|
||||
|
||||
assert ("Blacklist contains 3 pairs\n`DOGE/BTC, HOT/BTC, ETH/BTC`"
|
||||
in msg_mock.call_args_list[1][0][0])
|
||||
assert freqtradebot.pairlists.blacklist == ["DOGE/BTC", "HOT/BTC", "ETH/BTC"]
|
||||
|
||||
|
||||
def test_edge_disabled(default_conf, update, mocker) -> None:
|
||||
msg_mock = MagicMock()
|
||||
|
Reference in New Issue
Block a user