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([])
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([])
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)
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
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)
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
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()
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()