Move p1_monitor coordinator to separate module (#117562)

This commit is contained in:
epenet 2024-05-17 16:34:47 +02:00 committed by GitHub
parent c41962455e
commit fce4263493
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 93 additions and 81 deletions

View file

@ -27,7 +27,9 @@ def mock_config_entry() -> MockConfigEntry:
@pytest.fixture
def mock_p1monitor():
"""Return a mocked P1 Monitor client."""
with patch("homeassistant.components.p1_monitor.P1Monitor") as p1monitor_mock:
with patch(
"homeassistant.components.p1_monitor.coordinator.P1Monitor"
) as p1monitor_mock:
client = p1monitor_mock.return_value
client.smartmeter = AsyncMock(
return_value=SmartMeter.from_dict(

View file

@ -44,7 +44,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
async def test_api_error(hass: HomeAssistant) -> None:
"""Test we handle cannot connect error."""
with patch(
"homeassistant.components.p1_monitor.P1Monitor.smartmeter",
"homeassistant.components.p1_monitor.coordinator.P1Monitor.smartmeter",
side_effect=P1MonitorError,
):
result = await hass.config_entries.flow.async_init(

View file

@ -29,7 +29,7 @@ async def test_load_unload_config_entry(
@patch(
"homeassistant.components.p1_monitor.P1Monitor._request",
"homeassistant.components.p1_monitor.coordinator.P1Monitor._request",
side_effect=P1MonitorConnectionError,
)
async def test_config_entry_not_ready(