Philip Vanloo cde22a44db
Add LinkPlay integration (#113940)
* Intial commit

* Add artsound as virtual integration

* Add config_flow test
Add linkplay to .coveragerc
Add linkplay to .strict-typing

* Remove artsound component

* Bump package version

* Address mypy and coveragerc

* Address comments

* Address more feedback, add zeroconf and user flow

* Catch broken bridge in async_setup_entry

* Raise ConfigEntryNotReady, add __all__

* Implement new tests for the config_flow

* Fix async warning

* Fix test

* Address feedback

* Address comments

* Address comment

---------

Co-authored-by: Philip Vanloo <26272906+pvanloo@users.noreply.github.com>
2024-07-25 12:27:10 +02:00

41 lines
1.1 KiB
Python

"""Test configuration and mocks for LinkPlay component."""
from collections.abc import Generator
from unittest.mock import AsyncMock, patch
from linkplay.bridge import LinkPlayBridge, LinkPlayDevice
import pytest
HOST = "10.0.0.150"
HOST_REENTRY = "10.0.0.66"
UUID = "FF31F09E-5001-FBDE-0546-2DBFFF31F09E"
NAME = "Smart Zone 1_54B9"
@pytest.fixture
def mock_linkplay_factory_bridge() -> Generator[AsyncMock]:
"""Mock for linkplay_factory_bridge."""
with (
patch(
"homeassistant.components.linkplay.config_flow.linkplay_factory_bridge"
) as factory,
):
bridge = AsyncMock(spec=LinkPlayBridge)
bridge.endpoint = HOST
bridge.device = AsyncMock(spec=LinkPlayDevice)
bridge.device.uuid = UUID
bridge.device.name = NAME
factory.return_value = bridge
yield factory
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.linkplay.async_setup_entry",
return_value=True,
) as mock_setup_entry:
yield mock_setup_entry