ConvertResponseElementsToTable

This script is used to convert CrowdStrike IOA response elements to a table.

python · CrowdStrike Falcon

Details

IDConvertResponseElementsToTable
Languagepython
From Version6.8.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagsdynamic-section

README

This script is used to convert CrowdStrike IOA response elements to a table.

Script Data


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

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

from ConvertResponseElementsToTable import *
from pytest_mock import MockerFixture

CONTEXT_RESULTS = '{"key_1": "val_1", "key_2": "val_2", "key_3": "val_3", "key_4": "val_4"}'


def test_convert_to_table(mocker: MockerFixture):
    """
    Given:
        - A string that contains data of the incident field.
    When:
        - Calling convert_to_table function.
    Then:
        - Validate that the function tableToMarkdown is called with the correct arguments.
    """
    tableToMarkdown_mocker = mocker.patch("ConvertResponseElementsToTable.tableToMarkdown", side_effect=tableToMarkdown)
    convert_to_table(CONTEXT_RESULTS)
    call_args_list = tableToMarkdown_mocker.call_args_list[0][1]
    assert call_args_list.get("t") == json.loads(CONTEXT_RESULTS)
    assert call_args_list.get("headers") == ["key_1", "key_2", "key_3", "key_4"]
    assert call_args_list.get("is_auto_json_transform") is True
    assert call_args_list.get("headerTransform") == pascalToSpace