IbmAddNote

Use this script to add a note entry in Cortex XSOAR, which will then be mirrored as a note to an IBM QRadar SOAR incident. This script should be run within an incident.

python · IBM Security QRadar SOAR

Details

IDIbmAddNote
Languagepython
From Version6.10.0
Docker Imagedemisto/python3:3.12.13.10404775

README

Use this script to add a note with a tag (the “Note tag to IBM” defined in the instance configuration) as an entry in Cortex XSOAR, which will then be mirrored as a note to a IBM QRadar SOAR incident. This script should be run within an incident.

Script Data


Name Description
Script Type python3
Cortex XSOAR Version 6.8.0

Inputs


Argument Name Description
note Note to be added to the IBM QRadar SOAR incident.
tags The note tag. Use the note entry tag (defined in your instance configuration) to mirror the note to IBM QRadar SOAR.

Outputs


There are no outputs for this script.

import demistomock as demisto
from IbmAddNote import add_note


def test_add_comment_as_note(mocker):
    """Test if the correct arguments are given to the CommandResults object when
    adding a comment as a note.
    """
    # Mock the demisto.incident() to return a dummy incident with dbotMirrorId
    mocker.patch.object(demisto, "incident", return_value={"dbotMirrorId": "1000"})

    result = add_note({"note": "New Note", "tags": "FROM XSOAR"})

    assert result.readable_output == "New Note"
    assert result.tags == ["FROM XSOAR"]
    assert result.mark_as_note


def test_add_note_execute_command_called(mocker):
    """Test that executeCommand is called with correct arguments."""
    mocker.patch.object(demisto, "incident", return_value={"dbotMirrorId": "1000"})
    mock_execute = mocker.patch.object(demisto, "executeCommand", return_value=[])

    add_note({"note": "Test note", "tags": "FROM XSOAR"})

    mock_execute.assert_called_once_with("rs-add-note", args={"note": "Test note", "incident-id": "1000"})