mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Tests for zwave workaround detection (#6761)
* Tests for zwave workaround detection * Remove unused code * Revert "Remove unused code" This reverts commit e06cce0abecc233dab3488dc4194b2d296eee002. * Tests for empty manufacturer ID
This commit is contained in:
parent
8d606f8d16
commit
cffc6c7bea
@ -436,7 +436,6 @@ omit =
|
||||
homeassistant/components/zeroconf.py
|
||||
homeassistant/components/zwave/__init__.py
|
||||
homeassistant/components/zwave/util.py
|
||||
homeassistant/components/zwave/workaround.py
|
||||
|
||||
|
||||
[report]
|
||||
|
40
tests/components/zwave/test_workaround.py
Normal file
40
tests/components/zwave/test_workaround.py
Normal file
@ -0,0 +1,40 @@
|
||||
"""Test Z-Wave workarounds."""
|
||||
from homeassistant.components.zwave import const, workaround
|
||||
from tests.mock.zwave import MockNode, MockValue
|
||||
|
||||
|
||||
def test_get_device_no_component_mapping():
|
||||
"""Test that None is returned."""
|
||||
node = MockNode(manufacturer_id=' ')
|
||||
value = MockValue(data=0, node=node)
|
||||
assert workaround.get_device_component_mapping(value) is None
|
||||
|
||||
|
||||
def test_get_device_component_mapping():
|
||||
"""Test that component is returned."""
|
||||
node = MockNode(manufacturer_id='010f', product_type='0b00')
|
||||
value = MockValue(data=0, node=node,
|
||||
command_class=const.COMMAND_CLASS_SENSOR_ALARM)
|
||||
assert workaround.get_device_component_mapping(value) == 'binary_sensor'
|
||||
|
||||
|
||||
def test_get_device_no_mapping():
|
||||
"""Test that no device mapping is returned."""
|
||||
node = MockNode(manufacturer_id=' ')
|
||||
value = MockValue(data=0, node=node)
|
||||
assert workaround.get_device_mapping(value) is None
|
||||
|
||||
|
||||
def test_get_device_mapping_mt():
|
||||
"""Test that device mapping mt is returned."""
|
||||
node = MockNode(manufacturer_id='0047', product_type='5a52')
|
||||
value = MockValue(data=0, node=node)
|
||||
assert workaround.get_device_mapping(value) == 'workaround_no_position'
|
||||
|
||||
|
||||
def test_get_device_mapping_mtii():
|
||||
"""Test that device mapping mtii is returned."""
|
||||
node = MockNode(manufacturer_id='013c', product_type='0002',
|
||||
product_id='0002')
|
||||
value = MockValue(data=0, node=node, index=0)
|
||||
assert workaround.get_device_mapping(value) == 'trigger_no_off_event'
|
Loading…
x
Reference in New Issue
Block a user