def test_setup_platform_no_bridge_id(self): """Test setup_platform without a bridge.""" self.hass.data[hue.DOMAIN] = {} mock_add_devices = MagicMock() hue_light.setup_platform(self.hass, {}, mock_add_devices, {}) mock_add_devices.assert_not_called()
def test_setup_platform_no_discovery_info(self): """Test setup_platform without discovery info.""" self.hass.data[hue.DOMAIN] = {} mock_add_devices = MagicMock() hue_light.setup_platform(self.hass, {}, mock_add_devices) mock_add_devices.assert_not_called()
def test_setup_platform_one_bridge(self): """Test setup_platform with one bridge.""" mock_bridge = MagicMock() self.hass.data[hue.DOMAIN] = {'10.0.0.1': mock_bridge} mock_add_devices = MagicMock() with patch(HUE_LIGHT_NS + 'unthrottled_update_lights') \ as mock_update_lights: hue_light.setup_platform(self.hass, {}, mock_add_devices, {'bridge_id': '10.0.0.1'}) mock_update_lights.assert_called_once_with(self.hass, mock_bridge, mock_add_devices)
def test_setup_platform_one_bridge(self): """Test setup_platform with one bridge.""" mock_bridge = MagicMock() self.hass.data[hue.DOMAIN] = {'10.0.0.1': mock_bridge} mock_add_devices = MagicMock() with patch('homeassistant.components.light.hue.' + 'unthrottled_update_lights') as mock_update_lights: hue_light.setup_platform( self.hass, {}, mock_add_devices, {'bridge_id': '10.0.0.1'}) mock_update_lights.assert_called_once_with( self.hass, mock_bridge, mock_add_devices)
def test_setup_platform_multiple_bridges(self): """Test setup_platform wuth multiple bridges.""" mock_bridge = MagicMock() mock_bridge2 = MagicMock() self.hass.data[hue.DOMAIN] = { '10.0.0.1': mock_bridge, '192.168.0.10': mock_bridge2, } mock_add_devices = MagicMock() with patch(HUE_LIGHT_NS + 'unthrottled_update_lights') \ as mock_update_lights: hue_light.setup_platform(self.hass, {}, mock_add_devices, {'bridge_id': '10.0.0.1'}) hue_light.setup_platform(self.hass, {}, mock_add_devices, {'bridge_id': '192.168.0.10'}) mock_update_lights.assert_has_calls([ call(self.hass, mock_bridge, mock_add_devices), call(self.hass, mock_bridge2, mock_add_devices), ])
def test_setup_platform_multiple_bridges(self): """Test setup_platform wuth multiple bridges.""" mock_bridge = MagicMock() mock_bridge2 = MagicMock() self.hass.data[hue.DOMAIN] = { '10.0.0.1': mock_bridge, '192.168.0.10': mock_bridge2, } mock_add_devices = MagicMock() with patch('homeassistant.components.light.hue.' + 'unthrottled_update_lights') as mock_update_lights: hue_light.setup_platform( self.hass, {}, mock_add_devices, {'bridge_id': '10.0.0.1'}) hue_light.setup_platform( self.hass, {}, mock_add_devices, {'bridge_id': '192.168.0.10'}) mock_update_lights.assert_has_calls([ call(self.hass, mock_bridge, mock_add_devices), call(self.hass, mock_bridge2, mock_add_devices), ])