BreachConfirmationHTML

python · Common Scripts

Details

IDBreachConfirmationHTML
Languagepython
From Version6.5.0
Docker Imagedemisto/python3:3.12.13.10404775
Tagsdynamic-section

README

This Compliance content pack contains essential incidents fields that are used in the compliance-related packs.
The script in this pack is used for a dynamic field in the HIPAA Breach Notification Incident layout and the US Breach Notification layout to indicate if a breach was confirmed.

For more information, visit our Cortex XSOAR Developer Docs

import demistomock as demisto
import pytest
from BreachConfirmationHTML import main
from CommonServerPython import *

ARGS_MAIN = [
    ([{}], "<div style='color:green;'><h2>Pending Confirmation</h2></div>"),
    (
        [{"CustomFields": {"breachconfirmation": "Pending Confirmation"}}],
        "<div style='color:green;'><h2>Pending Confirmation</h2></div>",
    ),
    ([{"CustomFields": {"breachconfirmation": "Confirm"}}], "<div style='color:red;'><h2>Confirmed</h2></div>"),
    (
        [{"CustomFields": {"breachconfirmation": "Not Confirmed"}}],
        "<div style='color:green;'><h2>Pending Confirmation</h2></div>",
    ),
]


@pytest.mark.parametrize("incidents, except_html", ARGS_MAIN)
def test_main(incidents, except_html, mocker):
    """
    Given:
        - query
    When:
        - main function is executed
    Then:
        - Return results to War-Room
    """
    expected_args = {"ContentsFormat": formats["html"], "Type": entryTypes["note"], "Contents": except_html}
    mocker.patch.object(demisto, "incidents", return_value=incidents)
    moc = mocker.patch.object(demisto, "results")
    main()
    assert moc.call_args.args[0] == expected_args