IncidentsCheck-PlaybooksHealthNames

Health Check dynamic section, showing the top ten playbook names of the failed incidents in a bar chart.

python · Integrations & Incidents Health Check

Details

IDIncidentsCheck-PlaybooksHealthNames
Languagepython
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagsdynamic-section failedIncidents

README

Health Check dynamic section, showing the top ten playbook names of the failed incidents in a bar chart.

Script Data


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

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

import pytest
import demistomock as demisto
from IncidentsCheck_PlaybooksHealthNames import main, random
from test_data.constants import (
    INCIDENT_RESULT,
    INCIDENT_RESULT_NO_FAILED_COMMANDS,
    INCIDENT_RESULT_EXPECTED,
    INCIDENT_RESULT_NO_FAILED_COMMANDS_EXPECTED,
)


@pytest.mark.parametrize(
    "incidents_result, expected",
    [
        (INCIDENT_RESULT, INCIDENT_RESULT_EXPECTED),
        (INCIDENT_RESULT_NO_FAILED_COMMANDS, INCIDENT_RESULT_NO_FAILED_COMMANDS_EXPECTED),
    ],
)
def test_script(mocker, incidents_result, expected):
    mocker.patch.object(random, "randint", return_value=1000)
    mocker.patch.object(demisto, "incidents", return_value=incidents_result)
    mocker.patch.object(demisto, "results")

    main()

    contents = demisto.results.call_args[0][0].get("Contents")
    assert contents == expected