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!")
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)
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!")
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)
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!")