Add support for HomeWizard enable/disable cloud feature (#82573)
This commit is contained in:
parent
093bd00807
commit
27bd1520e8
12 changed files with 148 additions and 11 deletions
|
@ -2,7 +2,8 @@
|
|||
import json
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from homewizard_energy.models import Data, Device, State
|
||||
from homewizard_energy.features import Features
|
||||
from homewizard_energy.models import Data, Device, State, System
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.homewizard.const import DOMAIN
|
||||
|
@ -37,26 +38,32 @@ def mock_config_entry() -> MockConfigEntry:
|
|||
|
||||
@pytest.fixture
|
||||
def mock_homewizardenergy():
|
||||
"""Return a mocked P1 meter."""
|
||||
"""Return a mocked all-feature device."""
|
||||
with patch(
|
||||
"homeassistant.components.homewizard.coordinator.HomeWizardEnergy",
|
||||
) as device:
|
||||
client = device.return_value
|
||||
client.features = AsyncMock(return_value=Features("HWE-SKT", "3.01"))
|
||||
client.device = AsyncMock(
|
||||
return_value=Device.from_dict(
|
||||
side_effect=lambda: Device.from_dict(
|
||||
json.loads(load_fixture("homewizard/device.json"))
|
||||
)
|
||||
)
|
||||
client.data = AsyncMock(
|
||||
return_value=Data.from_dict(
|
||||
side_effect=lambda: Data.from_dict(
|
||||
json.loads(load_fixture("homewizard/data.json"))
|
||||
)
|
||||
)
|
||||
client.state = AsyncMock(
|
||||
return_value=State.from_dict(
|
||||
side_effect=lambda: State.from_dict(
|
||||
json.loads(load_fixture("homewizard/state.json"))
|
||||
)
|
||||
)
|
||||
client.system = AsyncMock(
|
||||
side_effect=lambda: System.from_dict(
|
||||
json.loads(load_fixture("homewizard/system.json"))
|
||||
)
|
||||
)
|
||||
yield device
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue