Query order history via the db.session
The query then runs in the same transaction as the `db.session` For that, `addresses_mock` now replaces only `session.query()` instead of the whole `db.session`.
This commit is contained in:
parent
6119064d71
commit
e9dbf528d7
2 changed files with 3 additions and 3 deletions
|
|
@ -141,7 +141,7 @@ class OrderHistory:
|
|||
start_at;
|
||||
""", # noqa:S608
|
||||
),
|
||||
con=db.connection,
|
||||
con=db.session.connection(),
|
||||
index_col=["pixel_id", "start_at"],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class TestAggregateOrders:
|
|||
"""
|
||||
|
||||
@pytest.fixture
|
||||
def addresses_mock(self, mocker, monkeypatch):
|
||||
def addresses_mock(self, db_session, mocker, monkeypatch):
|
||||
"""A `Mock` whose `.return_value` are to be set ...
|
||||
|
||||
... to the addresses that are gridified. The addresses are
|
||||
|
|
@ -29,7 +29,7 @@ class TestAggregateOrders:
|
|||
query = (
|
||||
mock.query.return_value.join.return_value.filter.return_value.all # noqa:E501
|
||||
)
|
||||
monkeypatch.setattr(db, "session", mock)
|
||||
monkeypatch.setattr(db_session, "query", mock.query)
|
||||
|
||||
return query
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue