Merge branch 'feat/short' into pr/samgermain/5567

This commit is contained in:
Matthias
2021-10-17 10:41:03 +02:00
17 changed files with 94 additions and 28 deletions

View File

@@ -95,7 +95,7 @@ def test_api_not_found(botclient):
assert rc.json() == {"detail": "Not Found"}
def test_api_ui_fallback(botclient):
def test_api_ui_fallback(botclient, mocker):
ftbot, client = botclient
rc = client_get(client, "/favicon.ico")
@@ -109,9 +109,16 @@ def test_api_ui_fallback(botclient):
rc = client_get(client, "/something")
assert rc.status_code == 200
# Test directory traversal
# Test directory traversal without mock
rc = client_get(client, '%2F%2F%2Fetc/passwd')
assert rc.status_code == 200
# Allow both fallback or real UI
assert '`freqtrade install-ui`' in rc.text or '<!DOCTYPE html>' in rc.text
mocker.patch.object(Path, 'is_file', MagicMock(side_effect=[True, False]))
rc = client_get(client, '%2F%2F%2Fetc/passwd')
assert rc.status_code == 200
assert '`freqtrade install-ui`' in rc.text
@@ -617,10 +624,11 @@ def test_api_delete_trade(botclient, mocker, fee, markets):
assert_response(rc, 502)
create_mock_trades(fee, False)
Trade.query.session.flush()
ftbot.strategy.order_types['stoploss_on_exchange'] = True
trades = Trade.query.all()
trades[1].stoploss_order_id = '1234'
Trade.commit()
assert len(trades) > 2
rc = client_delete(client, f"{BASE_URI}/trades/1")