def test_setup_component(self):
        """Test setup component with devices."""

        def _add_device(devices):
            assert len(devices) == 1
            assert devices[0].name == "Device_Vacuum"

        device_vacuum = _get_vacuum_device_cleaning()
        device_non_vacuum = _get_non_vacuum_device()
        self.hass.data[dyson.DYSON_DEVICES] = [device_vacuum, device_non_vacuum]
        dyson.setup_platform(self.hass, {}, _add_device)
示例#2
0
 def test_setup_component_with_no_devices(self):
     """Test setup component with no devices."""
     self.hass.data[dyson.DYSON_DEVICES] = []
     add_entities = mock.MagicMock()
     dyson.setup_platform(self.hass, {}, add_entities)
     add_entities.assert_called_with([])