The service code correctly awaits db.execute(...), but the tests build their mock session so that result.scalars() returns a coroutine, causing AttributeError: 'coroutine' object has no attribute 'first' (and 'all') inside otherwise-correct service code. Rework the mock setup (e.g. AsyncMock for execute, MagicMock for the result object) so the existing CRUD tests actually run.
Steps to reproduce: pytest tests/unit/test_review_service.py -q — observed: 13 failed, 6 passed.
The service code correctly awaits
db.execute(...), but the tests build their mock session so thatresult.scalars()returns a coroutine, causingAttributeError: 'coroutine' object has no attribute 'first'(and'all') inside otherwise-correct service code. Rework the mock setup (e.g.AsyncMockforexecute,MagicMockfor the result object) so the existing CRUD tests actually run.Steps to reproduce:
pytest tests/unit/test_review_service.py -q— observed: 13 failed, 6 passed.