def test_set_brightness_not_dimmable(self): """Test setting the brightness of a non dimmable Light.""" # pylint: disable=invalid-name xknx = XKNX(loop=self.loop) light = Light(xknx, name="TestLight", group_address_switch='1/2/3') self.loop.run_until_complete(asyncio.Task(light.set_brightness(23))) self.assertEqual(xknx.telegrams.qsize(), 0) # Nothing should happen
def test_set_brightness_not_dimmable(self): """Test setting the brightness of a non dimmable Light.""" # pylint: disable=invalid-name xknx = XKNX() light = Light(xknx, name="TestLight", group_address_switch="1/2/3") with patch("logging.Logger.warning") as mock_warn: self.loop.run_until_complete(light.set_brightness(23)) self.assertEqual(xknx.telegrams.qsize(), 0) mock_warn.assert_called_with("Dimming not supported for device %s", "TestLight")
def test_set_brightness(self): """Test setting the brightness of a Light.""" xknx = XKNX(loop=self.loop) light = Light(xknx, name="TestLight", group_address_switch='1/2/3', group_address_brightness='1/2/5') self.loop.run_until_complete(asyncio.Task(light.set_brightness(23))) self.assertEqual(xknx.telegrams.qsize(), 1) telegram = xknx.telegrams.get_nowait() self.assertEqual(telegram, Telegram(Address('1/2/5'), payload=DPTArray(23)))
def test_set_brightness(self): """Test setting the brightness of a Light.""" xknx = XKNX() light = Light( xknx, name="TestLight", group_address_switch="1/2/3", group_address_brightness="1/2/5", ) self.loop.run_until_complete(light.set_brightness(23)) self.assertEqual(xknx.telegrams.qsize(), 1) telegram = xknx.telegrams.get_nowait() self.assertEqual(telegram, Telegram(GroupAddress("1/2/5"), payload=DPTArray(23)))