Speed up unit test test_fiat_convert_get_price and test_fiat_convert_find_price
Change the mock of the unit test_fiat_convert_get_price Duration get optimized: - test_fiat_convert_get_price from 1.83s to 0.08s - test_fiat_convert_find_price from 1.72s to 0.08s
This commit is contained in:
parent
074a4ef65b
commit
6899b33130
@ -63,10 +63,12 @@ def test_fiat_convert_add_pair():
|
||||
|
||||
def test_fiat_convert_find_price(mocker):
|
||||
api_mock = MagicMock(return_value={
|
||||
'price_usd': 12345.0,
|
||||
'ticker': MagicMock(return_value={
|
||||
'price_usd': 12345.0,
|
||||
'price_eur': 13000.2
|
||||
})
|
||||
})
|
||||
mocker.patch('freqtrade.fiat_convert.Pymarketcap.ticker', api_mock)
|
||||
mocker.patch('freqtrade.fiat_convert.Pymarketcap', api_mock)
|
||||
fiat_convert = CryptoToFiatConverter()
|
||||
|
||||
with pytest.raises(ValueError, match=r'The fiat ABC is not supported.'):
|
||||
@ -82,10 +84,12 @@ def test_fiat_convert_find_price(mocker):
|
||||
|
||||
def test_fiat_convert_get_price(mocker):
|
||||
api_mock = MagicMock(return_value={
|
||||
'price_usd': 28000.0,
|
||||
'price_eur': 15000.0
|
||||
'ticker': MagicMock(return_value={
|
||||
'price_usd': 28000.0,
|
||||
'price_eur': 15000.0
|
||||
})
|
||||
})
|
||||
mocker.patch('freqtrade.fiat_convert.Pymarketcap.ticker', api_mock)
|
||||
mocker.patch('freqtrade.fiat_convert.Pymarketcap', api_mock)
|
||||
mocker.patch('freqtrade.fiat_convert.CryptoToFiatConverter._find_price', return_value=28000.0)
|
||||
|
||||
fiat_convert = CryptoToFiatConverter()
|
||||
|
Loading…
Reference in New Issue
Block a user