Exemplo n.º 1
0
 def test_setup_component_with_invalid_devices(self):
     """Test setup component with invalid devices."""
     devices = [None, "foo_bar"]
     self.hass.data[dyson.DYSON_DEVICES] = devices
     add_devices = mock.MagicMock()
     dyson.setup_platform(self.hass, None, add_devices, discovery_info={})
     add_devices.assert_called_with([])
Exemplo n.º 2
0
 def test_setup_component_with_invalid_devices(self):
     """Test setup component with invalid devices."""
     devices = [
         None,
         "foo_bar"
     ]
     self.hass.data[dyson.DYSON_DEVICES] = devices
     add_devices = mock.MagicMock()
     dyson.setup_platform(self.hass, None, add_devices, discovery_info={})
     add_devices.assert_called_with([])
Exemplo n.º 3
0
    def test_setup_component(self):
        """Test setup component with devices."""
        device_fan = _get_device_heat_on()
        device_non_fan = _get_device_off()

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

        self.hass.data[dyson.DYSON_DEVICES] = [device_fan, device_non_fan]
        dyson.setup_platform(self.hass, None, _add_device)
Exemplo n.º 4
0
 def test_setup_component_with_devices(self):
     """Test setup component with valid devices."""
     devices = [
         _get_device_with_no_state(),
         _get_device_off(),
         _get_device_heat_on(),
     ]
     self.hass.data[dyson.DYSON_DEVICES] = devices
     add_devices = mock.MagicMock()
     dyson.setup_platform(self.hass, None, add_devices, discovery_info={})
     assert add_devices.called
Exemplo n.º 5
0
    def test_setup_component(self):
        """Test setup component with devices."""
        device_fan = _get_device_heat_on()
        device_non_fan = _get_device_off()

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

        self.hass.data[dyson.DYSON_DEVICES] = [device_fan, device_non_fan]
        dyson.setup_platform(self.hass, None, _add_device)
Exemplo n.º 6
0
 def test_setup_component_with_devices(self):
     """Test setup component with valid devices."""
     devices = [
         _get_device_with_no_state(),
         _get_device_off(),
         _get_device_heat_on()
     ]
     self.hass.data[dyson.DYSON_DEVICES] = devices
     add_devices = mock.MagicMock()
     dyson.setup_platform(self.hass, None, add_devices, discovery_info={})
     assert add_devices.called
Exemplo n.º 7
0
 def test_setup_component_without_devices(self):
     """Test setup component with no devices."""
     self.hass.data[dyson.DYSON_DEVICES] = []
     add_devices = mock.MagicMock()
     dyson.setup_platform(self.hass, None, add_devices)
     add_devices.assert_not_called()
Exemplo n.º 8
0
 def test_setup_component_without_devices(self):
     """Test setup component with no devices."""
     self.hass.data[dyson.DYSON_DEVICES] = []
     add_devices = mock.MagicMock()
     dyson.setup_platform(self.hass, None, add_devices)
     add_devices.assert_not_called()