'Test if setup adds devices.'

@mock.patch('mficlient.client.MFiClient')
@mock.patch('homeassistant.components.switch.mfi.MfiSwitch')
def test_setup_adds_proper_devices(self, mock_switch, mock_client):

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