CBAlerts

Get the list of Alerts from Carbon Black Enterprise Response. Supports the same arguments as the cb-alerts command.

python · Carbon Black Enterprise Response

Details

IDCBAlerts
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagscarbon-black

README

Gets the list of alerts from Carbon Black Enterprise Response. This script supports the same arguments as the cb-alerts command.

Script Data


Name Description
Script Type python
Tags carbon-black

Dependencies


This script uses the following commands and scripts.

  • cb-alert

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

import demistomock as demisto  # noqa: F401
import pytest
from CommonServerPython import *

QUERY_COMMAND_RESPONSE = [
    (
        [{"Type": entryTypes["note"], "Contents": {"results": [{"test": "test_value", "test2": "test_value2"}]}}],
        [{"test": "test_value", "test2": "test_value2"}],
    ),
    ([{"Type": entryTypes["note"], "Contents": {"results": []}}], "No matches."),
]


@pytest.mark.parametrize("res, contents", QUERY_COMMAND_RESPONSE)
def test_mimecast_find_email(res, contents, mocker):
    mocker.patch.object(demisto, "executeCommand", return_value=res)
    mocker.patch.object(demisto, "results")
    mocker.patch.object(demisto, "args", return_value={})

    from CBAlerts import main

    main()
    results = demisto.results.call_args[0][0]

    assert results[0].get("Contents") == contents