Skip to content

Commit

Permalink
Further improve MFI tests (home-assistant#43167)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob authored Nov 13, 2020
1 parent 3404e6d commit 890d740
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/components/mfi/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ async def test_setup_adds_proper_devices(hass):
"homeassistant.components.mfi.sensor.MfiSensor", side_effect=mfi.MfiSensor
) as mock_sensor:
ports = {
i: mock.MagicMock(model=model) for i, model in enumerate(mfi.SENSOR_MODELS)
i: mock.MagicMock(model=model, label=f"Port {i}", value=0)
for i, model in enumerate(mfi.SENSOR_MODELS)
}
ports["bad"] = mock.MagicMock(model="notasensor")
mock_client.return_value.get_devices.return_value = [
Expand Down
5 changes: 4 additions & 1 deletion tests/components/mfi/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ async def test_setup_adds_proper_devices(hass):
"homeassistant.components.mfi.switch.MfiSwitch", side_effect=mfi.MfiSwitch
) as mock_switch:
ports = {
i: mock.MagicMock(model=model) for i, model in enumerate(mfi.SWITCH_MODELS)
i: mock.MagicMock(
model=model, label=f"Port {i}", output=False, data={}, ident=f"abcd-{i}"
)
for i, model in enumerate(mfi.SWITCH_MODELS)
}
ports["bad"] = mock.MagicMock(model="notaswitch")
print(ports["bad"].model)
Expand Down

0 comments on commit 890d740

Please sign in to comment.