1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-26 14:08:21 +00:00

Break out mock of pymodbus return from mock_modbus to new fixture (#55063)

* Remove unused mock_modbus.

* Break out mock pymodbus return values.

* Review comments.
This commit is contained in:
jan iversen
2021-08-23 23:55:57 +02:00
committed by GitHub
parent 7314b1c8e1
commit f91d214ba4
8 changed files with 98 additions and 37 deletions

View File

@@ -157,36 +157,41 @@ async def test_config_light(hass, mock_modbus):
],
)
@pytest.mark.parametrize(
"register_words,config_addon,expected",
"register_words,do_exception,config_addon,expected",
[
(
[0x00],
False,
{CONF_VERIFY: {}},
STATE_OFF,
),
(
[0x01],
False,
{CONF_VERIFY: {}},
STATE_ON,
),
(
[0xFE],
False,
{CONF_VERIFY: {}},
STATE_OFF,
),
(
None,
[0x00],
True,
{CONF_VERIFY: {}},
STATE_UNAVAILABLE,
),
(
None,
[0x00],
True,
None,
STATE_OFF,
),
],
)
async def test_all_light(hass, mock_modbus, mock_do_cycle, expected):
async def test_all_light(hass, mock_do_cycle, expected):
"""Run test for given config."""
assert hass.states.get(ENTITY_ID).state == expected