Add db migration test
This commit is contained in:
parent
5d4a247fa0
commit
e14f2cc275
@ -3,7 +3,11 @@
|
|||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from freqtrade.util.binance_mig import migrate_binance_futures_data
|
import pytest
|
||||||
|
|
||||||
|
from freqtrade.persistence import Trade
|
||||||
|
from freqtrade.util.binance_mig import migrate_binance_futures_data, migrate_binance_futures_names
|
||||||
|
from tests.conftest import create_mock_trades_usdt, log_has
|
||||||
|
|
||||||
|
|
||||||
def test_binance_mig_data_conversion(default_conf_usdt, tmpdir, testdatadir):
|
def test_binance_mig_data_conversion(default_conf_usdt, tmpdir, testdatadir):
|
||||||
@ -35,3 +39,21 @@ def test_binance_mig_data_conversion(default_conf_usdt, tmpdir, testdatadir):
|
|||||||
for file in files:
|
for file in files:
|
||||||
fn_after = futures_dst / f'{pair_unified}{file}'
|
fn_after = futures_dst / f'{pair_unified}{file}'
|
||||||
assert fn_after.exists()
|
assert fn_after.exists()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("init_persistence")
|
||||||
|
def test_binance_mig_db_conversion(default_conf_usdt, fee, caplog):
|
||||||
|
# Does nothing in spot mode
|
||||||
|
migrate_binance_futures_names(default_conf_usdt)
|
||||||
|
|
||||||
|
create_mock_trades_usdt(fee, None)
|
||||||
|
|
||||||
|
for t in Trade.get_trades():
|
||||||
|
t.trading_mode = 'FUTURES'
|
||||||
|
t.exchange = 'binance'
|
||||||
|
Trade.commit()
|
||||||
|
|
||||||
|
default_conf_usdt['datadir'] = Path(default_conf_usdt['datadir'])
|
||||||
|
default_conf_usdt['trading_mode'] = 'futures'
|
||||||
|
migrate_binance_futures_names(default_conf_usdt)
|
||||||
|
assert log_has('Migrating binance futures pairs in database.', caplog)
|
||||||
|
Loading…
Reference in New Issue
Block a user