CortexXDRCloudProviderWidget

This script returns an HTML result of the cloud providers in the incident. The result will be displayed in the following font colors: AWS - red, GCP - green, Azure - blue.

python · Cortex XDR by Palo Alto Networks

Details

IDCortexXDRCloudProviderWidget
Languagepython
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagsdynamic-section

README

This script returns an HTML result of the cloud providers in the incident. The result will be displayed
in the following font colors: AWS - red, GCP - green, Azure - blue.

Script Data


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

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

import CortexXDRCloudProviderWidget
import pytest
from CommonServerPython import *


def util_load_json(path):
    with open(path, encoding="utf-8") as f:
        return json.loads(f.read())


@pytest.mark.parametrize(
    "incident_data, expected_result",
    [
        (util_load_json("test_data/incident_data.json"), {"AWS"}),
        (util_load_json("test_data/multi_clouds_incident_data.json"), {"AWS", "GCP", "Azure"}),
    ],
)
def test_cloud_provider(mocker, incident_data, expected_result):
    mocker.patch.object(demisto, "incident", return_value=incident_data)
    results = CortexXDRCloudProviderWidget.get_cloud_providers()
    assert results == expected_result


def test_cloud_provider_other_provider(mocker):
    mocker.patch.object(CortexXDRCloudProviderWidget, "get_cloud_providers", return_value={"IBM"})
    results = CortexXDRCloudProviderWidget.get_cloudprovider_html_result()
    assert "000000" in results.get("Contents")  # if not GCP, AWS or Azure should be in black