From 01ad65de68f30d9516ae5ce4da9417a4bcaae49c Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Sat, 13 Nov 2021 19:22:43 -0600 Subject: [PATCH] test_rpc_apiserver.py --- .../plugins/protections/stoploss_guard.py | 2 +- tests/rpc/test_rpc_apiserver.py | 22 +++++++++---------- tests/rpc/test_rpc_telegram.py | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/freqtrade/plugins/protections/stoploss_guard.py b/freqtrade/plugins/protections/stoploss_guard.py index 888dc0316..79b311f2b 100644 --- a/freqtrade/plugins/protections/stoploss_guard.py +++ b/freqtrade/plugins/protections/stoploss_guard.py @@ -32,7 +32,7 @@ class StoplossGuard(IProtection): def _reason(self) -> str: """ LockReason to use - #TODO-lev: check if min is the right word for shorts + # TODO-lev: check if min is the right word for shorts """ return (f'{self._trade_limit} stoplosses in {self._lookback_period} min, ' f'locking for {self._stop_duration} min.') diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index a3788872f..e0e73f6f1 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -586,10 +586,10 @@ def test_api_trades(botclient, mocker, fee, markets, is_short): assert rc.json()['total_trades'] == 2 -# TODO-lev: @pytest.mark.parametrize('is_short', [True, False]) -def test_api_trade_single(botclient, mocker, fee, ticker, markets): +@pytest.mark.parametrize('is_short', [True, False]) +def test_api_trade_single(botclient, mocker, fee, ticker, markets, is_short): ftbot, client = botclient - patch_get_signal(ftbot) + patch_get_signal(ftbot, enter_long=not is_short, enter_short=is_short) mocker.patch.multiple( 'freqtrade.exchange.Exchange', markets=PropertyMock(return_value=markets), @@ -599,7 +599,7 @@ def test_api_trade_single(botclient, mocker, fee, ticker, markets): assert_response(rc, 404) assert rc.json()['detail'] == 'Trade not found.' - create_mock_trades(fee, False) + create_mock_trades(fee, is_short=is_short) Trade.query.session.flush() rc = client_get(client, f"{BASE_URI}/trade/3") @@ -607,10 +607,10 @@ def test_api_trade_single(botclient, mocker, fee, ticker, markets): assert rc.json()['trade_id'] == 3 -# TODO-lev: @pytest.mark.parametrize('is_short', [True, False]) -def test_api_delete_trade(botclient, mocker, fee, markets): +@pytest.mark.parametrize('is_short', [True, False]) +def test_api_delete_trade(botclient, mocker, fee, markets, is_short): ftbot, client = botclient - patch_get_signal(ftbot) + patch_get_signal(ftbot, enter_long=not is_short, enter_short=is_short) stoploss_mock = MagicMock() cancel_mock = MagicMock() mocker.patch.multiple( @@ -749,10 +749,10 @@ def test_api_profit(botclient, mocker, ticker, fee, markets): } -# TODO-lev: @pytest.mark.parametrize('is_short', [True, False]) -def test_api_stats(botclient, mocker, ticker, fee, markets,): +@pytest.mark.parametrize('is_short', [True, False]) +def test_api_stats(botclient, mocker, ticker, fee, markets, is_short): ftbot, client = botclient - patch_get_signal(ftbot) + patch_get_signal(ftbot, enter_long=not is_short, enter_short=is_short) mocker.patch.multiple( 'freqtrade.exchange.Exchange', get_balances=MagicMock(return_value=ticker), @@ -766,7 +766,7 @@ def test_api_stats(botclient, mocker, ticker, fee, markets,): assert 'durations' in rc.json() assert 'sell_reasons' in rc.json() - create_mock_trades(fee, False) + create_mock_trades(fee, is_short=is_short) rc = client_get(client, f"{BASE_URI}/stats") assert_response(rc, 200) diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index d88c7b24e..522883a36 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -1261,8 +1261,8 @@ def test_edge_enabled(edge_conf, update, mocker) -> None: assert 'Winrate' not in msg_mock.call_args_list[0][0][0] -# TODO-lev: @pytest.mark.parametrize('is_short', [True, False]) -def test_telegram_trades(mocker, update, default_conf, fee): +@pytest.mark.parametrize('is_short', [True, False]) +def test_telegram_trades(mocker, update, default_conf, fee, is_short): telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)