Add 404 when strategy is not found

This commit is contained in:
Matthias
2020-09-17 07:53:22 +02:00
parent becccca3d1
commit b38f68b3b0
4 changed files with 36 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ Unit test file for rpc/api_server.py
"""
from datetime import datetime
from pathlib import Path
from unittest.mock import ANY, MagicMock, PropertyMock
import pytest
@@ -945,6 +946,21 @@ def test_api_strategies(botclient):
assert rc.json == {'strategies': ['DefaultStrategy', 'TestStrategyLegacy']}
def test_api_strategy(botclient):
ftbot, client = botclient
rc = client_get(client, f"{BASE_URI}/strategy/DefaultStrategy")
assert_response(rc)
assert rc.json['strategy'] == 'DefaultStrategy'
data = (Path(__file__).parents[1] / "strategy/strats/default_strategy.py").read_text()
assert rc.json['code'] == data
rc = client_get(client, f"{BASE_URI}/strategy/NoStrat")
assert_response(rc, 404)
def test_list_available_pairs(botclient):
ftbot, client = botclient