'Test if setup adds devices.'

@mock.patch('mficlient.client.MFiClient')
@mock.patch('homeassistant.components.sensor.mfi.MfiSensor')
def test_setup_adds_proper_devices(self, mock_sensor, mock_client):

    ports = {i: mock.MagicMock(model=model) for (i, model) in enumerate(mfi.SENSOR_MODELS)}
    ports['bad'] = mock.MagicMock(model='notasensor')
    mock_client.return_value.get_devices.return_value = [mock.MagicMock(ports=ports)]
    assert setup_component(self.hass, sensor.DOMAIN, self.GOOD_CONFIG)
    for (ident, port) in ports.items():
        if (ident != 'bad'):
            mock_sensor.assert_any_call(port, self.hass)
    assert (mock.call(ports['bad'], self.hass) not in mock_sensor.mock_calls)
