Skip to content

fix(tests): replace Mock() with AsyncMock() in test_voice_auth.py _FakeVoiceService #753

Closed

Description

@vybe

Summary

18 tests in `tests/unit/test_voice_auth.py` all fail with:
```
TypeError: An asyncio.Future, a coroutine or an awaitable is required
```

The `_FakeVoiceService` stub uses `Mock()` for `get_session`, `remove_session`, and `create_session`, which are `async def` methods. They must use `AsyncMock()` instead.

Context

Discovered via full test suite run on 2026-05-10. The fix is mechanical — three one-line changes in a single file. No production code is affected.

Acceptance Criteria

  • In `tests/unit/test_voice_auth.py`, change `Mock()` to `AsyncMock()` for `get_session`, `remove_session`, and `create_session` in `_FakeVoiceService`
  • `python -m pytest tests/unit/test_voice_auth.py -v` reports 18 passed, 0 failed
  • No other tests in the suite are broken by the change

Technical Notes

```python

Before

get_session = Mock(return_value=None)
remove_session = Mock()
create_session = Mock(return_value=fake_session)

After

from unittest.mock import AsyncMock
get_session = AsyncMock(return_value=None)
remove_session = AsyncMock()
create_session = AsyncMock(return_value=fake_session)
```

Activity

  1. added
    priority-p1
    type-bug
    on May 10, 2026
  2. vybe commented on May 10, 2026

    @vybe
    ContributorAuthor

    /claim

  3. github-actions commented on May 10, 2026

    @github-actions

    Claimed by @vybe. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/753-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #753
  4. added
    status-in-progress
    on May 10, 2026
  5. vybe commented on May 10, 2026

    @vybe
    ContributorAuthor

    This is already fixed. The AsyncMock replacements for get_session, remove_session, and create_session in _FakeVoiceService were applied in commit 32e06c8 (PR #714, shipped 2026-05-08) as part of greening the full unit-test suite. All 19 tests in tests/unit/test_voice_auth.py currently pass.

  6. added
    complexity-low
    theme-devex
    on Jun 3, 2026
  7. removed
    status-in-progress
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-lowpriority-p1theme-devextype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions