CortexXDRRemediationActionsWidget

This widget displays Cortex XDR remediation action information.

python · Cortex XDR by Palo Alto Networks

Details

IDCortexXDRRemediationActionsWidget
Languagepython
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagsdynamic-section

README

This widget displays Cortex XDR remediation action information.

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 json

import CortexXDRRemediationActionsWidget
import pytest
from CommonServerPython import *


def util_load_json(path):
    with open(path, encoding="utf-8") as f:
        return json.loads(f.read())


@pytest.mark.parametrize(
    "context_data, expected_result",
    [
        (util_load_json("test_data/context_data1.json"), util_load_json("test_data/expected_results1.json")),
        (util_load_json("test_data/context_data2.json"), util_load_json("test_data/expected_results2.json")),
    ],
)
def test_remediation_info(mocker, context_data, expected_result):
    mocker.patch.object(demisto, "context", return_value=context_data)
    mocker.patch.object(
        CortexXDRRemediationActionsWidget, "indicators_value_to_clickable", side_effect=lambda x: {a: a for a in x}
    )
    results = CortexXDRRemediationActionsWidget.get_remediation_info()
    assert len(expected_result.keys()) == len(results.keys())
    for expected_key, expected_value in expected_result.items():
        assert expected_key in results
        assert set(results[expected_key]) == set(expected_value)