GetEnabledInstances

Gets all currently enabled integration instances.

python · Common Scripts

Details

IDGetEnabledInstances
Languagepython
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10404775

README

Gets all currently enabled integration instances.

Script Data


Name Description
Script Type python3
Tags  
Cortex XSOAR Version 6.0.0

Inputs


There are no inputs for this script.

Outputs


Path Description Type
EnabledInstances A list of integration instance names that are currently enabled. List
import demistomock as demisto
from GetEnabledInstances import main


def test_get_enabled_instances(mocker):
    """
    Given:
        - An enabled instance named instanceName1
        - A disabled instance named instanceName2
    When:
        - Calling GetEnabledInstances script
    Then:
        - Ensure only the enabled instances is returned to the context.
    """

    mock_modules = {
        "instanceName1": {"state": "active", "brand": "brandName"},
        "instanceName2": {"state": "disabled", "brand": "brandName"},
        "instanceName3": {"state": "active", "brand": "testmodule"},
    }
    mocker.patch.object(demisto, "results")
    mocker.patch.object(demisto, "getModules", return_value=mock_modules)
    main()
    result = demisto.results.call_args[0][0]["Contents"]
    assert "instanceName1" in result
    assert "instanceName2" not in result
    assert "instanceName3" not in result