Add Number platform to Roborock (#94209)
This commit is contained in:
38
tests/components/roborock/test_number.py
Normal file
38
tests/components/roborock/test_number.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Test Roborock Number platform."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.number import ATTR_VALUE, SERVICE_SET_VALUE
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("entity_id", "value"),
|
||||
[
|
||||
("number.roborock_s7_maxv_volume", 3.0),
|
||||
],
|
||||
)
|
||||
async def test_update_success(
|
||||
hass: HomeAssistant,
|
||||
bypass_api_fixture,
|
||||
setup_entry: MockConfigEntry,
|
||||
entity_id: str,
|
||||
value: float,
|
||||
) -> None:
|
||||
"""Test allowed changing values for number entities."""
|
||||
# Ensure that the entity exist, as these test can pass even if there is no entity.
|
||||
assert hass.states.get(entity_id) is not None
|
||||
with patch(
|
||||
"homeassistant.components.roborock.coordinator.RoborockLocalClient.send_message"
|
||||
) as mock_send_message:
|
||||
await hass.services.async_call(
|
||||
"number",
|
||||
SERVICE_SET_VALUE,
|
||||
service_data={ATTR_VALUE: value},
|
||||
blocking=True,
|
||||
target={"entity_id": entity_id},
|
||||
)
|
||||
assert mock_send_message.assert_called_once
|
||||
Reference in New Issue
Block a user