Further improve MFI tests (#43167)

pull/43176/head
Paulus Schoutsen 2020-11-13 10:51:27 +01:00 committed by GitHub
parent 3404e6ded1
commit 890d740093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -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 = [

View File

@ -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)