IntegrationsCheck-Widget-IntegrationsCategory

Data output script for populating the dashboard pie graph widget with the failing integrations.

python · Integrations & Incidents Health Check

Details

IDIntegrationsCheck-Widget-IntegrationsCategory
Languagepython
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagswidget failedInstances

README

Data output script for populating the dashboard pie graph widget with the failing integrations.

Script Data


Name Description
Script Type python3
Tags widget, failedInstances
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 IntegrationsCheck_Widget_IntegrationsCategory import main, random


@pytest.mark.parametrize(
    "list_, expected",
    [
        (
            [
                {
                    "Contents": "Data Enrichment & Threat Intelligence,Vulnerability Management,Endpoint,Forensics & Malware "
                    "Analysis,Data Enrichment & Threat Intelligence,Endpoint"
                }
            ],
            (
                '[{"data": [2], "name": "Data Enrichment & Threat Intelligence", "color": '
                '"#0003e8"}, {"data": [2], "name": "Endpoint", "color": "#0003e8"}, {"data": [1], '
                '"name": "Vulnerability Management", "color": "#0003e8"}, {"data": [1], "name": '
                '"Forensics & Malware Analysis", "color": "#0003e8"}]'
            ),
        ),
        ([{"Contents": ""}], '[{"data": [0], "name": "N/A", "color": "#00CD33"}]'),
        ([{}], '[{"data": [0], "name": "N/A", "color": "#00CD33"}]'),
    ],
)
def test_script(mocker, list_, expected):
    mocker.patch.object(random, "randint", return_value=1000)
    mocker.patch.object(demisto, "executeCommand", return_value=list_)
    mocker.patch.object(demisto, "results")

    main()

    contents = demisto.results.call_args[0][0]
    assert contents == expected