def test_when_execute_stm_tasks_then_priority_todo_moved_to_sent_queue( self): ctrl = RobotController(MagicMock(), MagicMock(), MagicMock(), MagicMock()) command = {'command': Command.MOVE_FORWARD, 'amplitude': 2222} ctrl._stm_commands_todo.append(command) ctrl._execute_stm_tasks() self.assertEqual(command, ctrl._stm_sent_queue.get())
def test_when_execute_stm_tasks_then_send_via_channel(self): channel = MagicMock() channel.attach_mock(Mock(), 'send_command') command = {'command': Command.MOVE_FORWARD, 'amplitude': 2222} ctrl = RobotController(MagicMock(), MagicMock(), MagicMock(), channel) ctrl._stm_commands_todo.append(command) ctrl._execute_stm_tasks() channel.send_command.assert_called_once_with( StmCommand.factory(command))