예제 #1
0
    def test_execute_unknown_device(self):
        """Test if execute method of Action calls correct do method of device."""
        xknx = XKNX(loop=self.loop)

        action = Action(xknx, target='Light1', method='on')
        with patch('logging.Logger.warning') as logger_warning_mock:
            self.loop.run_until_complete(asyncio.Task(action.execute()))
            logger_warning_mock.assert_called_once_with(
                "Unknown device %s witin action %s.", action.target, action)
예제 #2
0
파일: action_test.py 프로젝트: phbaer/xknx
    def test_execute_unknown_device(self):
        """Test if execute method of Action calls correct do method of device."""
        xknx = XKNX(loop=self.loop)

        action = Action(xknx, target='Light1', method='on')
        with patch('logging.Logger.warning') as logger_warning_mock:
            self.loop.run_until_complete(asyncio.Task(action.execute()))
            logger_warning_mock.assert_called_once_with(
                "Unknown device %s witin action %s.", action.target, action)
예제 #3
0
파일: action_test.py 프로젝트: cian/xknx
 def test_execute_action(self):
     """Test if execute method of Action calls correct do method of device."""
     xknx = XKNX(loop=self.loop)
     light = Light(xknx, "Light1", group_address_switch="1/6/4")
     action = Action(xknx, target=light.name, method="on")
     with patch("xknx.devices.Light.do") as mock_do:
         fut = asyncio.Future()
         fut.set_result(None)
         mock_do.return_value = fut
         self.loop.run_until_complete(action.execute())
         mock_do.assert_called_with("on")
예제 #4
0
 def test_execute_action(self):
     """Test if execute method of Action calls correct do method of device."""
     xknx = XKNX(loop=self.loop)
     light = Light(xknx, 'Light1', group_address_switch='1/6/4')
     xknx.devices.add(light)
     action = Action(xknx, target='Light1', method='on')
     with patch('xknx.devices.Light.do') as mock_do:
         fut = asyncio.Future()
         fut.set_result(None)
         mock_do.return_value = fut
         self.loop.run_until_complete(asyncio.Task(action.execute()))
         mock_do.assert_called_with('on')
예제 #5
0
파일: action_test.py 프로젝트: phbaer/xknx
 def test_execute_action(self):
     """Test if execute method of Action calls correct do method of device."""
     xknx = XKNX(loop=self.loop)
     light = Light(
         xknx,
         'Light1',
         group_address_switch='1/6/4')
     xknx.devices.add(light)
     action = Action(xknx, target='Light1', method='on')
     with patch('xknx.devices.Light.do') as mock_do:
         fut = asyncio.Future()
         fut.set_result(None)
         mock_do.return_value = fut
         self.loop.run_until_complete(asyncio.Task(action.execute()))
         mock_do.assert_called_with('on')