Exemplo n.º 1
0
 def test_do(self):
     """Test running scene with do command."""
     xknx = XKNX(loop=self.loop)
     scene = Scene(xknx,
                   "TestScene",
                   group_address="1/2/1",
                   scene_number=23)
     self.loop.run_until_complete(scene.do("run"))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(
         telegram, Telegram(GroupAddress("1/2/1"), payload=DPTArray(0x16)))
Exemplo n.º 2
0
 def test_wrong_do(self):
     """Test wrong do command."""
     xknx = XKNX(loop=self.loop)
     scene = Scene(
         xknx,
         'TestScene',
         group_address='1/2/1',
         scene_number=23)
     with patch('logging.Logger.warning') as mockWarn:
         self.loop.run_until_complete(asyncio.Task(scene.do("execute")))
         mockWarn.assert_called_with('Could not understand action %s for device %s', 'execute', 'TestScene')
     self.assertEqual(xknx.telegrams.qsize(), 0)
Exemplo n.º 3
0
 def test_wrong_do(self):
     """Test wrong do command."""
     xknx = XKNX(loop=self.loop)
     scene = Scene(
         xknx,
         'TestScene',
         group_address='1/2/1',
         scene_number=23)
     with patch('logging.Logger.warning') as mockWarn:
         self.loop.run_until_complete(asyncio.Task(scene.do("execute")))
         mockWarn.assert_called_with('Could not understand action %s for device %s', 'execute', 'TestScene')
     self.assertEqual(xknx.telegrams.qsize(), 0)
Exemplo n.º 4
0
 def test_wrong_do(self):
     """Test wrong do command."""
     xknx = XKNX(loop=self.loop)
     scene = Scene(xknx,
                   "TestScene",
                   group_address="1/2/1",
                   scene_number=23)
     with patch("logging.Logger.warning") as mockWarn:
         self.loop.run_until_complete(scene.do("execute"))
         mockWarn.assert_called_with(
             "Could not understand action %s for device %s", "execute",
             "TestScene")
     self.assertEqual(xknx.telegrams.qsize(), 0)
Exemplo n.º 5
0
 def test_do(self):
     """Test running scene with do command."""
     xknx = XKNX(loop=self.loop)
     scene = Scene(
         xknx,
         'TestScene',
         group_address='1/2/1',
         scene_number=23)
     self.loop.run_until_complete(asyncio.Task(scene.do("run")))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(telegram,
                      Telegram(GroupAddress('1/2/1'), payload=DPTArray(0x16)))