'Test setup OK if device already exists.'

@mock.patch('libsoundtouch.soundtouch_device', side_effect=None)
def test_ensure_setup_discovery_no_duplicate(self, mocked_sountouch_device):

    soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock())
    self.assertEqual(len(self.hass.data[soundtouch.DATA_SOUNDTOUCH]), 1)
    new_device = {'port': '8090', 'host': '192.168.1.1', 'properties': {}, 'hostname': 'hostname.local'}
    soundtouch.setup_platform(self.hass, None, mock.MagicMock(), new_device)
    self.assertEqual(len(self.hass.data[soundtouch.DATA_SOUNDTOUCH]), 2)
    existing_device = {'port': '8090', 'host': '192.168.0.1', 'properties': {}, 'hostname': 'hostname.local'}
    soundtouch.setup_platform(self.hass, None, mock.MagicMock(), existing_device)
    self.assertEqual(mocked_sountouch_device.call_count, 2)
    self.assertEqual(len(self.hass.data[soundtouch.DATA_SOUNDTOUCH]), 2)
