Move p1_monitor coordinator to separate module (#117562)
This commit is contained in:
parent
c41962455e
commit
fce4263493
7 changed files with 93 additions and 81 deletions
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue