mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-04-29 13:31:22 +00:00
Improve code styles ...
This commit is contained in:
@@ -112,7 +112,7 @@ def assert_response(response, expected_code=200, needs_cors=True):
|
||||
|
||||
|
||||
def test_api_not_found(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/invalid_url")
|
||||
assert_response(rc, 404)
|
||||
@@ -120,7 +120,7 @@ def test_api_not_found(botclient):
|
||||
|
||||
|
||||
def test_api_ui_fallback(botclient, mocker):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, "/favicon.ico")
|
||||
assert rc.status_code == 200
|
||||
@@ -150,7 +150,7 @@ def test_api_ui_fallback(botclient, mocker):
|
||||
|
||||
|
||||
def test_api_ui_version(botclient, mocker):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
mocker.patch('freqtrade.commands.deploy_commands.read_ui_version', return_value='0.1.2')
|
||||
rc = client_get(client, "/ui_version")
|
||||
@@ -230,7 +230,7 @@ def test_api_unauthorized(botclient):
|
||||
|
||||
|
||||
def test_api_token_login(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
rc = client.post(f"{BASE_URI}/token/login",
|
||||
data=None,
|
||||
headers={'Authorization': _basic_auth_str('WRONG_USER', 'WRONG_PASS'),
|
||||
@@ -249,7 +249,7 @@ def test_api_token_login(botclient):
|
||||
|
||||
|
||||
def test_api_token_refresh(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
rc = client_post(client, f"{BASE_URI}/token/login")
|
||||
assert_response(rc)
|
||||
rc = client.post(f"{BASE_URI}/token/refresh",
|
||||
@@ -541,7 +541,7 @@ def test_api_count(botclient, mocker, ticker, fee, markets, is_short):
|
||||
|
||||
|
||||
def test_api_locks(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/locks")
|
||||
assert_response(rc)
|
||||
@@ -821,7 +821,7 @@ def test_api_trade_reload_trade(botclient, mocker, fee, markets, ticker, is_shor
|
||||
|
||||
|
||||
def test_api_logs(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
rc = client_get(client, f"{BASE_URI}/logs")
|
||||
assert_response(rc)
|
||||
assert len(rc.json()) == 2
|
||||
@@ -1228,7 +1228,7 @@ def test_api_status(botclient, mocker, ticker, fee, markets, is_short,
|
||||
|
||||
|
||||
def test_api_version(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/version")
|
||||
assert_response(rc)
|
||||
@@ -1236,7 +1236,7 @@ def test_api_version(botclient):
|
||||
|
||||
|
||||
def test_api_blacklist(botclient, mocker):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/blacklist")
|
||||
assert_response(rc)
|
||||
@@ -1303,7 +1303,7 @@ def test_api_blacklist(botclient, mocker):
|
||||
|
||||
|
||||
def test_api_whitelist(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/whitelist")
|
||||
assert_response(rc)
|
||||
@@ -1558,7 +1558,7 @@ def test_api_pair_candles(botclient, ohlcv_history):
|
||||
|
||||
|
||||
def test_api_pair_history(botclient, mocker):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
timeframe = '5m'
|
||||
lfm = mocker.patch('freqtrade.strategy.interface.IStrategy.load_freqAI_model')
|
||||
# No pair
|
||||
@@ -1698,7 +1698,7 @@ def test_api_strategies(botclient, tmp_path):
|
||||
|
||||
|
||||
def test_api_strategy(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/strategy/{CURRENT_TEST_STRATEGY}")
|
||||
|
||||
@@ -1717,7 +1717,7 @@ def test_api_strategy(botclient):
|
||||
|
||||
|
||||
def test_api_exchanges(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/exchanges")
|
||||
assert_response(rc)
|
||||
@@ -1954,7 +1954,7 @@ def test_list_available_pairs(botclient):
|
||||
|
||||
|
||||
def test_sysinfo(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/sysinfo")
|
||||
assert_response(rc)
|
||||
@@ -2234,7 +2234,7 @@ def test_api_patch_backtest_history_entry(botclient, tmp_path: Path):
|
||||
|
||||
|
||||
def test_health(botclient):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/health")
|
||||
|
||||
@@ -2245,7 +2245,7 @@ def test_health(botclient):
|
||||
|
||||
|
||||
def test_api_ws_subscribe(botclient, mocker):
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
ws_url = f"/api/v1/message/ws?token={_TEST_WS_TOKEN}"
|
||||
|
||||
sub_mock = mocker.patch('freqtrade.rpc.api_server.ws.WebSocketChannel.set_subscriptions')
|
||||
@@ -2268,7 +2268,7 @@ def test_api_ws_subscribe(botclient, mocker):
|
||||
def test_api_ws_requests(botclient, caplog):
|
||||
caplog.set_level(logging.DEBUG)
|
||||
|
||||
ftbot, client = botclient
|
||||
_ftbot, client = botclient
|
||||
ws_url = f"/api/v1/message/ws?token={_TEST_WS_TOKEN}"
|
||||
|
||||
# Test whitelist request
|
||||
|
||||
@@ -599,7 +599,7 @@ async def test_daily_handle(default_conf_usdt, update, ticker, fee, mocker, time
|
||||
get_fee=fee,
|
||||
)
|
||||
|
||||
telegram, freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf_usdt)
|
||||
telegram, _freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf_usdt)
|
||||
|
||||
# Move date to within day
|
||||
time_machine.move_to('2022-06-11 08:00:00+00:00')
|
||||
@@ -1480,7 +1480,7 @@ async def test_telegram_performance_handle(default_conf_usdt, update, ticker, fe
|
||||
fetch_ticker=ticker,
|
||||
get_fee=fee,
|
||||
)
|
||||
telegram, freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf_usdt)
|
||||
telegram, _freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf_usdt)
|
||||
|
||||
# Create some test data
|
||||
create_mock_trades_usdt(fee)
|
||||
@@ -1655,7 +1655,7 @@ async def test_telegram_lock_handle(default_conf, update, ticker, fee, mocker) -
|
||||
|
||||
async def test_whitelist_static(default_conf, update, mocker) -> None:
|
||||
|
||||
telegram, freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||
telegram, _freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||
|
||||
await telegram._whitelist(update=update, context=MagicMock())
|
||||
assert msg_mock.call_count == 1
|
||||
@@ -2647,7 +2647,7 @@ async def test__send_msg_keyboard(default_conf, mocker, caplog) -> None:
|
||||
|
||||
|
||||
async def test_change_market_direction(default_conf, mocker, update) -> None:
|
||||
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||
telegram, _, _msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||
assert telegram._rpc._freqtrade.strategy.market_direction == MarketDirection.NONE
|
||||
context = MagicMock()
|
||||
context.args = ["long"]
|
||||
|
||||
Reference in New Issue
Block a user