def METHOD_NAME(op_mock):
    # Mock the session
    session_mock = MagicMock()
    # Arrange
    agent_execution_id = 1
    agent_config = {"agent_id": 2, "permission_type": "RESTRICTED"}
    assistant_reply = '{"tool": {"name": "someAction", "args": ["arg1", "arg2"]}}'
    op_mock.parse.return_value = AgentGPTAction(name="someAction", args=["arg1", "arg2"])
    tool = MagicMock()
    tool.name = "someAction"
    tool.permission_required = True
    handler = ToolOutputHandler(agent_execution_id, agent_config, [tool],None)
    # Act
    response = handler._check_permission_in_restricted_mode(session_mock, assistant_reply)
    # Assert
    assert response.is_permission_required
    assert response.status == "WAITING_FOR_PERMISSION"
    session_mock.add.assert_called_once()
    session_mock.commit.assert_called_once()