Update remaining tests to get rid of .query

This commit is contained in:
Matthias
2023-03-16 18:07:06 +01:00
parent 9d6e973e5b
commit 4cfbc55d34
5 changed files with 25 additions and 15 deletions

View File

@@ -711,8 +711,8 @@ def test_PrecisionFilter_error(mocker, whitelist_conf) -> None:
def test_PerformanceFilter_error(mocker, whitelist_conf, caplog) -> None:
whitelist_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PerformanceFilter"}]
if hasattr(Trade, 'query'):
del Trade.query
if hasattr(Trade, 'session'):
del Trade.session
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
exchange = get_patched_exchange(mocker, whitelist_conf)
pm = PairListManager(exchange, whitelist_conf, MagicMock())

View File

@@ -107,7 +107,7 @@ def test_PairLocks_getlongestlock(use_db):
# No lock should be present
PairLocks.use_db = use_db
if use_db:
assert len(PairLock.query.all()) == 0
assert len(PairLock.get_all_locks().all()) == 0
assert PairLocks.use_db == use_db
@@ -139,7 +139,7 @@ def test_PairLocks_reason(use_db):
PairLocks.use_db = use_db
# No lock should be present
if use_db:
assert len(PairLock.query.all()) == 0
assert len(PairLock.get_all_locks().all()) == 0
assert PairLocks.use_db == use_db