'Test filtering of duplicates.'

@patch('homeassistant.components.media_player.cast.CastDevice')
@patch('pychromecast.get_chromecasts')
def test_filter_duplicates(self, mock_get_chromecasts, mock_device):

    mock_get_chromecasts.return_value = [FakeChromeCast('some_host', cast.DEFAULT_PORT)]
    cast.setup_platform(self.hass, {'host': 'some_host'}, (lambda _: _))
    assert mock_device.called
    mock_device.reset_mock()
    assert (not mock_device.called)
    cast.setup_platform(self.hass, {}, (lambda _: _), {'host': 'some_host', 'port': cast.DEFAULT_PORT})
    assert (not mock_device.called)
