示例#1
0
文件: scene_test.py 项目: cian/xknx
 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)))
示例#2
0
文件: scene_test.py 项目: phbaer/xknx
 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)
示例#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)
示例#4
0
文件: scene_test.py 项目: cian/xknx
 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)
示例#5
0
文件: scene_test.py 项目: phbaer/xknx
 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)))