Skip to content

review_service unit tests misconfigure async mocks — 13 of 19 tests fail #158

Description

@ascherj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtestsTeststier-1Starter: good for first-time contributors

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions