update tests

This commit is contained in:
iuvbio
2019-03-05 19:46:03 +01:00
parent c30fb7f590
commit e234158cc9
5 changed files with 166 additions and 196 deletions

View File

@@ -2,7 +2,7 @@
# pragma pylint: disable=invalid-sequence-index, invalid-name, too-many-arguments
from datetime import datetime
from unittest.mock import MagicMock, ANY
from unittest.mock import MagicMock, ANY, PropertyMock
import pytest
from numpy import isnan
@@ -34,7 +34,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, markets, mocker) -> None:
_load_markets=MagicMock(return_value={}),
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets)
)
freqtradebot = FreqtradeBot(default_conf)
@@ -90,7 +90,7 @@ def test_rpc_status_table(default_conf, ticker, fee, markets, mocker) -> None:
'freqtrade.exchange.Exchange',
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets)
)
freqtradebot = FreqtradeBot(default_conf)
@@ -126,7 +126,7 @@ def test_rpc_daily_profit(default_conf, update, ticker, fee,
'freqtrade.exchange.Exchange',
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets)
)
freqtradebot = FreqtradeBot(default_conf)
@@ -180,7 +180,7 @@ def test_rpc_trade_statistics(default_conf, ticker, ticker_sell_up, fee,
'freqtrade.exchange.Exchange',
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets)
)
freqtradebot = FreqtradeBot(default_conf)
@@ -268,7 +268,7 @@ def test_rpc_trade_statistics_closed(mocker, default_conf, ticker, fee, markets,
'freqtrade.exchange.Exchange',
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets)
)
freqtradebot = FreqtradeBot(default_conf)
@@ -424,7 +424,7 @@ def test_rpc_forcesell(default_conf, ticker, fee, mocker, markets) -> None:
}
),
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets)
)
freqtradebot = FreqtradeBot(default_conf)
@@ -516,7 +516,7 @@ def test_performance_handle(default_conf, ticker, limit_buy_order, fee,
get_balances=MagicMock(return_value=ticker),
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets)
)
freqtradebot = FreqtradeBot(default_conf)
@@ -552,7 +552,7 @@ def test_rpc_count(mocker, default_conf, ticker, fee, markets) -> None:
get_balances=MagicMock(return_value=ticker),
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets)
)
freqtradebot = FreqtradeBot(default_conf)
@@ -581,7 +581,7 @@ def test_rpcforcebuy(mocker, default_conf, ticker, fee, markets, limit_buy_order
get_balances=MagicMock(return_value=ticker),
get_ticker=ticker,
get_fee=fee,
get_markets=markets,
markets=PropertyMock(return_value=markets),
buy=buy_mm
)

View File

@@ -5,7 +5,7 @@
import re
from datetime import datetime
from random import randint
from unittest.mock import MagicMock
from unittest.mock import MagicMock, PropertyMock
import arrow
import pytest
@@ -184,7 +184,7 @@ def test_status(default_conf, update, mocker, fee, ticker, markets) -> None:
'freqtrade.exchange.Exchange',
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(markets)
)
msg_mock = MagicMock()
status_table = MagicMock()
@@ -693,7 +693,8 @@ def test_forcesell_handle(default_conf, update, ticker, fee,
_load_markets=MagicMock(return_value={}),
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets),
validate_pairs=MagicMock(return_value={})
)
freqtradebot = FreqtradeBot(default_conf)
@@ -743,7 +744,8 @@ def test_forcesell_down_handle(default_conf, update, ticker, fee,
_load_markets=MagicMock(return_value={}),
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets),
validate_pairs=MagicMock(return_value={})
)
freqtradebot = FreqtradeBot(default_conf)
@@ -796,7 +798,8 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, markets, mocker
'freqtrade.exchange.Exchange',
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(return_value=markets),
validate_pairs=MagicMock(return_value={})
)
freqtradebot = FreqtradeBot(default_conf)
@@ -878,7 +881,8 @@ def test_forcebuy_handle(default_conf, update, markets, mocker) -> None:
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
_load_markets=MagicMock(return_value={}),
get_markets=markets
markets=PropertyMock(markets),
validate_pairs=MagicMock(return_value={})
)
fbuy_mock = MagicMock(return_value=None)
mocker.patch('freqtrade.rpc.RPC._rpc_forcebuy', fbuy_mock)
@@ -914,7 +918,8 @@ def test_forcebuy_handle_exception(default_conf, update, markets, mocker) -> Non
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
_load_markets=MagicMock(return_value={}),
get_markets=markets
markets=PropertyMock(markets),
validate_pairs=MagicMock(return_value={})
)
freqtradebot = FreqtradeBot(default_conf)
patch_get_signal(freqtradebot, (True, False))
@@ -941,7 +946,8 @@ def test_performance_handle(default_conf, update, ticker, fee,
'freqtrade.exchange.Exchange',
get_ticker=ticker,
get_fee=fee,
get_markets=markets
markets=PropertyMock(markets),
validate_pairs=MagicMock(return_value={})
)
mocker.patch('freqtrade.freqtradebot.RPCManager', MagicMock())
freqtradebot = FreqtradeBot(default_conf)
@@ -980,7 +986,7 @@ def test_count_handle(default_conf, update, ticker, fee, markets, mocker) -> Non
'freqtrade.exchange.Exchange',
get_ticker=ticker,
buy=MagicMock(return_value={'id': 'mocked_order_id'}),
get_markets=markets
markets=PropertyMock(markets)
)
mocker.patch('freqtrade.exchange.Exchange.get_fee', fee)
freqtradebot = FreqtradeBot(default_conf)