test__get_contract_size creates its own markets instead of using the markets from conftest

This commit is contained in:
Sam Germain 2021-12-31 04:50:55 -06:00
parent a85566d6c3
commit d105bb764a

View File

@ -3747,11 +3747,27 @@ def test__calculate_funding_fees_datetime_called(
('LTC/ETH', 1, 'futures'), ('LTC/ETH', 1, 'futures'),
('ETH/USDT:USDT', 10, 'futures') ('ETH/USDT:USDT', 10, 'futures')
]) ])
def test__get_contract_size(mocker, default_conf, markets, pair, expected_size, trading_mode): def test__get_contract_size(mocker, default_conf, pair, expected_size, trading_mode):
api_mock = MagicMock() api_mock = MagicMock()
default_conf['trading_mode'] = trading_mode default_conf['trading_mode'] = trading_mode
default_conf['collateral'] = 'isolated' default_conf['collateral'] = 'isolated'
mocker.patch('freqtrade.exchange.Exchange.markets', markets) mocker.patch('freqtrade.exchange.Exchange.markets', {
'LTC/USD': {
'symbol': 'LTC/USD',
'contractSize': None,
},
'XLTCUSDT': {
'symbol': 'XLTCUSDT',
'contractSize': 0.01,
},
'LTC/ETH': {
'symbol': 'LTC/ETH',
},
'ETH/USDT:USDT': {
'symbol': 'ETH/USDT:USDT',
'contractSize': 10,
}
})
exchange = get_patched_exchange(mocker, default_conf, api_mock) exchange = get_patched_exchange(mocker, default_conf, api_mock)
size = exchange._get_contract_size(pair) size = exchange._get_contract_size(pair)
assert expected_size == size assert expected_size == size