示例#1
0
 def test_do(self):
     """Test 'do' functionality."""
     xknx = XKNX(loop=self.loop)
     notification = Notification(xknx, 'Warning', group_address='1/2/3')
     self.loop.run_until_complete(
         asyncio.Task(notification.do("message:Ein Prosit!")))
     self.assertEqual(notification.message, "Ein Prosit!")
示例#2
0
 def test_wrong_do(self):
     """Test wrong do command."""
     xknx = XKNX(loop=self.loop)
     notification = Notification(xknx, 'Warning', group_address='1/2/3')
     with patch('logging.Logger.warning') as mock_warn:
         self.loop.run_until_complete(asyncio.Task(notification.do("execute")))
         mock_warn.assert_called_with('Could not understand action %s for device %s', 'execute', 'Warning')
     self.assertEqual(xknx.telegrams.qsize(), 0)
示例#3
0
 def test_do(self):
     """Test 'do' functionality."""
     xknx = XKNX(loop=self.loop)
     notification = Notification(xknx, "Warning", group_address="1/2/3")
     self.loop.run_until_complete(notification.do("message:Ein Prosit!"))
     self.loop.run_until_complete(
         xknx.devices.process(xknx.telegrams.get_nowait()))
     self.assertEqual(notification.message, "Ein Prosit!")
示例#4
0
 def test_wrong_do(self):
     """Test wrong do command."""
     xknx = XKNX(loop=self.loop)
     notification = Notification(xknx, 'Warning', group_address='1/2/3')
     with patch('logging.Logger.warning') as mock_warn:
         self.loop.run_until_complete(asyncio.Task(notification.do("execute")))
         mock_warn.assert_called_with('Could not understand action %s for device %s', 'execute', 'Warning')
     self.assertEqual(xknx.telegrams.qsize(), 0)
示例#5
0
 def test_wrong_do(self):
     """Test wrong do command."""
     xknx = XKNX(loop=self.loop)
     notification = Notification(xknx, "Warning", group_address="1/2/3")
     with patch("logging.Logger.warning") as mock_warn:
         self.loop.run_until_complete(notification.do("execute"))
         mock_warn.assert_called_with(
             "Could not understand action %s for device %s", "execute",
             "Warning")
     self.assertEqual(xknx.telegrams.qsize(), 0)
示例#6
0
 def test_do(self):
     """Test 'do' functionality."""
     xknx = XKNX(loop=self.loop)
     notification = Notification(xknx, 'Warning', group_address='1/2/3')
     self.loop.run_until_complete(asyncio.Task(notification.do("message:Ein Prosit!")))
     self.assertEqual(notification.message, "Ein Prosit!")