Fix base64 strategy test to make sure strategy was loaded via base64
This commit is contained in:
parent
b35efd96dc
commit
88eb93da52
@ -1,5 +1,6 @@
|
|||||||
# pragma pylint: disable=missing-docstring, protected-access, C0103
|
# pragma pylint: disable=missing-docstring, protected-access, C0103
|
||||||
import logging
|
import logging
|
||||||
|
import tempfile
|
||||||
import warnings
|
import warnings
|
||||||
from base64 import urlsafe_b64encode
|
from base64 import urlsafe_b64encode
|
||||||
from os import path
|
from os import path
|
||||||
@ -68,11 +69,15 @@ def test_load_strategy(result):
|
|||||||
assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
|
assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
|
||||||
|
|
||||||
|
|
||||||
def test_load_strategy_base64(result):
|
def test_load_strategy_base64(result, caplog):
|
||||||
with open("freqtrade/tests/strategy/test_strategy.py", "rb") as file:
|
with open("user_data/strategies/test_strategy.py", "rb") as file:
|
||||||
encoded_string = urlsafe_b64encode(file.read()).decode("utf-8")
|
encoded_string = urlsafe_b64encode(file.read()).decode("utf-8")
|
||||||
resolver = StrategyResolver({'strategy': 'TestStrategy:{}'.format(encoded_string)})
|
resolver = StrategyResolver({'strategy': 'TestStrategy:{}'.format(encoded_string)})
|
||||||
assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
|
assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
|
||||||
|
# Make sure strategy was loaded from base64 (using temp directory)!!
|
||||||
|
assert log_has_re(r"Using resolved strategy TestStrategy from '"
|
||||||
|
+ tempfile.gettempdir() + r"/.*/TestStrategy\.py'\.\.\.",
|
||||||
|
caplog.record_tuples)
|
||||||
|
|
||||||
|
|
||||||
def test_load_strategy_invalid_directory(result, caplog):
|
def test_load_strategy_invalid_directory(result, caplog):
|
||||||
|
Loading…
Reference in New Issue
Block a user