Query with select() in Grid and Path
`Session.query()` is the legacy API in SQLAlchemy 2.x. Unlike `Query`, `select()` does not deduplicate single entities from a `JOIN`; so, `Grid.gridify()` calls `.unique()` explicitly. The `addresses_mock` fixtures mock the new call chain.
This commit is contained in:
parent
1f5a39f83a
commit
53e1859ee8
1 changed files with 15 additions and 12 deletions
|
|
@ -26,8 +26,8 @@ class TestAggregateOrders:
|
|||
Note: This fixture also exists in `tests.db.test_grids`.
|
||||
"""
|
||||
mock = mocker.Mock()
|
||||
query = mock.query.return_value.join.return_value.filter.return_value.all
|
||||
monkeypatch.setattr(db_session, "query", mock.query)
|
||||
query = mock.scalars.return_value.unique.return_value.all
|
||||
monkeypatch.setattr(db_session, "scalars", mock.scalars)
|
||||
|
||||
return query
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue