/
/
/
1"""Shared helpers for the config controller tests."""
2
3from __future__ import annotations
4
5from typing import TYPE_CHECKING
6
7from music_assistant.controllers.config.controller import ConfigController
8
9if TYPE_CHECKING:
10 from unittest.mock import MagicMock
11
12
13def build_bare_config_controller(mock_mass: MagicMock) -> ConfigController:
14 """
15 Build a bare ConfigController wired to the given mocked mass.
16
17 Mock setup must go through the caller's own ``mock_mass`` (not ``controller.mass``):
18 ``ConfigController.mass`` is statically typed as ``MusicAssistant``, so reading it
19 back would resolve real (non-mock) attribute/overload types instead of the mock's,
20 even though the object assigned at runtime is the mock.
21
22 :param mock_mass: Mocked Music Assistant instance to build the controller on.
23 """
24 controller = ConfigController.__new__(ConfigController)
25 controller.mass = mock_mass
26 return controller
27