Ensure entity platform in mochad tests (#135725)

This commit is contained in:
G Johansson 2025-01-17 09:10:29 +01:00 committed by GitHub
parent 8e39c65759
commit cd88913daf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,8 @@ from homeassistant.components.mochad import switch as mochad
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from tests.common import MockEntityPlatform
@pytest.fixture(autouse=True)
def pymochad_mock():
@ -25,7 +27,9 @@ def switch_mock(hass: HomeAssistant) -> mochad.MochadSwitch:
"""Mock switch."""
controller_mock = mock.MagicMock()
dev_dict = {"address": "a1", "name": "fake_switch"}
return mochad.MochadSwitch(hass, controller_mock, dev_dict)
entity = mochad.MochadSwitch(hass, controller_mock, dev_dict)
entity.platform = MockEntityPlatform(hass)
return entity
async def test_setup_adds_proper_devices(hass: HomeAssistant) -> None: