Add config flow to MPD (#117907)
This commit is contained in:
parent
c9911e4dd4
commit
b26f613d06
9 changed files with 469 additions and 16 deletions
43
tests/components/mpd/conftest.py
Normal file
43
tests/components/mpd/conftest.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
"""Fixtures for Music Player Daemon integration tests."""
|
||||
|
||||
from collections.abc import Generator
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.mpd.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_config_entry() -> MockConfigEntry:
|
||||
"""Return the default mocked config entry."""
|
||||
return MockConfigEntry(
|
||||
title="Music Player Daemon",
|
||||
domain=DOMAIN,
|
||||
data={CONF_HOST: "192.168.0.1", CONF_PORT: 6600, CONF_PASSWORD: "test123"},
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
|
||||
"""Mock setting up a config entry."""
|
||||
with patch(
|
||||
"homeassistant.components.mpd.async_setup_entry", return_value=True
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_mpd_client() -> Generator[AsyncMock, None, None]:
|
||||
"""Return a mock for Music Player Daemon client."""
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.mpd.config_flow.MPDClient",
|
||||
autospec=True,
|
||||
) as mpd_client:
|
||||
client = mpd_client.return_value
|
||||
client.password = AsyncMock()
|
||||
yield client
|
Loading…
Add table
Add a link
Reference in a new issue