IntegrationsCheck-Widget-IntegrationsErrorsInfo

Data output script for populating the dashboard table graph widget with the information about failing integrations.

python · Integrations & Incidents Health Check

Details

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

README

Data output script for populating the dashboard table graph widget with the information about 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_IntegrationsErrorsInfo import main
from test_data.constants import FAILED_TABLE, FAILED_TABLE_EXPECTED


@pytest.mark.parametrize(
    "list_, expected",
    [
        (
            [{"Contents": "Item not found (8)"}],
            {"data": [{"Brand": None, "Category": None, "Information": None, "Instance": None}], "total": 1},
        ),
        ([{"Contents": FAILED_TABLE}], FAILED_TABLE_EXPECTED),
        (
            [{"Contents": ""}],
            {"data": [{"Brand": "N/A", "Category": "N/A", "Information": "N/A", "Instance": "N/A"}], "total": 1},
        ),
        ([{}], {"data": [{"Brand": "N/A", "Category": "N/A", "Information": "N/A", "Instance": "N/A"}], "total": 1}),
    ],
)
def test_script(mocker, list_, expected):
    mocker.patch.object(demisto, "executeCommand", return_value=list_)
    mocker.patch.object(demisto, "results")

    main()

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