SplunkConvertCommentsToTable

This script is used to convert Splunk comments to a table.

python · Splunk

Details

IDSplunkConvertCommentsToTable
Languagepython
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10404775
Tagsdynamic-section

README

This script is used to convert Splunk comments to a table.

Script Data


Name Description
Script Type python3
Tags dynamic-section
Cortex XSOAR Version 6.0.0

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

import SplunkConvertCommentsToTable

EXPECTED_TABLE = "|Comment|\n|---|\n| new comment |\n"


def test_convert_to_table(mocker):
    """
    Given:
        - A list of comments of a Jira issue in string format
    When:
        - Calling convert_to_table function
    Then:
        - Validate the table is created correctly
    """
    incident = {"CustomFields": {"splunkcomments": ['{"Comment":"new comment"}']}}
    mocker.patch("demistomock.incident", return_value=incident)
    result = SplunkConvertCommentsToTable.main()

    assert result.readable_output == EXPECTED_TABLE