Query with select() in Pixel

`Session.query()` is the legacy API in SQLAlchemy 2.x.

The addresses with restaurants are now selected with a subquery in one statement.

The `_restaurants_mock` fixture mocks the new call chain.
This commit is contained in:
Alexander Hess 2026-12-01 23:42:29 +01:00
commit 2eb6b5769f
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -121,7 +121,7 @@ class TestProperties:
def _restaurants_mock(self, mocker, monkeypatch, restaurant):
"""A `Mock` whose `.return_value` is `[restaurant]`."""
mock = mocker.Mock()
query = mock.query.return_value.join.return_value.filter.return_value.all
query = mock.scalars.return_value.all
query.return_value = [restaurant]
monkeypatch.setattr(db, "session", mock)