IncidentsCheck-NumberofIncidentsNoOwner

Health Check dynamic section, showing the number of unassigned incidents.

python · Integrations & Incidents Health Check

Details

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

README

Health Check dynamic section, showing the number of unassigned incidents.

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_NumberofIncidentsNoOwner import main, RED_HTML_STYLE, GREEN_HTML_STYLE


@pytest.mark.parametrize(
    "incident_ids, expected",
    [
        (["1", "2", "3"], f"<h1 style={RED_HTML_STYLE}3</h1>"),
        (["2"], f"<h1 style={RED_HTML_STYLE}1</h1>"),
        ([], f"<h1 style={GREEN_HTML_STYLE}0</h1>"),
        (None, f"<h1 style={GREEN_HTML_STYLE}0</h1>"),
    ],
)
def test_script(mocker, incident_ids, expected):
    mocker.patch.object(demisto, "incidents", return_value=[{"CustomFields": {"unassignedincidents": incident_ids}}])
    mocker.patch.object(demisto, "results")

    main()

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