remove .query from most tests

This commit is contained in:
Matthias
2023-03-16 07:25:04 +01:00
parent 6ed337faa3
commit 9d6e973e5b
9 changed files with 144 additions and 134 deletions

View File

@@ -14,7 +14,7 @@ def test_PairLocks(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
@@ -88,13 +88,13 @@ def test_PairLocks(use_db):
if use_db:
locks = PairLocks.get_all_locks()
locks_db = PairLock.query.all()
locks_db = PairLock.get_all_locks().all()
assert len(locks) == len(locks_db)
assert len(locks_db) > 0
else:
# Nothing was pushed to the database
assert len(PairLocks.get_all_locks()) > 0
assert len(PairLock.query.all()) == 0
assert len(PairLock.get_all_locks().all()) == 0
# Reset use-db variable
PairLocks.reset_locks()
PairLocks.use_db = True

View File

@@ -74,7 +74,7 @@ def generate_mock_trade(pair: str, fee: float, is_open: bool,
trade.close(close_price)
trade.exit_reason = exit_reason
Trade.query.session.add(trade)
Trade.session.add(trade)
Trade.commit()
return trade