'Test a advertise address config\'d by the HASS config file.'

@mock.patch('soco.SoCo', new=SoCoMock)
@mock.patch('socket.create_connection', side_effect=socket.error())
@mock.patch('soco.discover')
def test_ensure_setup_config_advertise_addr(self, discover_mock, *args):

    discover_mock.return_value = {SoCoMock('192.0.2.1')}
    config = {DOMAIN: {CONF_PLATFORM: 'sonos', CONF_ADVERTISE_ADDR: '192.0.1.1'}}
    assert setup_component(self.hass, DOMAIN, config)
    self.assertEqual(len(self.hass.data[sonos.DATA_SONOS]), 1)
    self.assertEqual(discover_mock.call_count, 1)
    self.assertEqual(soco.config.EVENT_ADVERTISE_IP, '192.0.1.1')
