DataminrPulseTransformExtractedIndicatorsToList
Script used to transform result received from the extractIndicators (Builtin) script from the dictionary of indicators to a list of indicators.
python · Dataminr Pulse
Details
| ID | DataminrPulseTransformExtractedIndicatorsToList |
|---|---|
| Language | python |
| From Version | 6.5.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
README
Script used to transform result received from the extractIndicators (Builtin) script from the dictionary of indicators to a list of indicators.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Cortex XSOAR Version | 6.5.0 |
Inputs
| Argument Name | Description |
|---|---|
| ExtractedIndicators | Response from extractIndicators (Builtin) script. |
Outputs
| Path | Description | Type |
|---|---|---|
| TransformedIndicators.indicatorList | Indicator list. | Unknown |
import pytest from DataminrPulseTransformExtractedIndicatorsToList import transform_extracted_indicators_command def test_transform_extracted_indicators_command(): """ Test the transform_extracted_indicators_command function. Given: - ExtractedIndicators argument containing a JSON string of extracted indicators When: - Calling `transform_extracted_indicators_command` function Then: - Verify that the function returns a CommandResults object with proper outputs and readable output. """ args = {"ExtractedIndicators": '{"url": ["http://example.com", "http://example.org"], "ip": ["1.2.3.4", "5.6.7.8"]}'} expected_output = {"indicatorList": ["http://example.com", "http://example.org", "1.2.3.4", "5.6.7.8"]} expected_readable_output = "List of indicators\n\nhttp://example.com, http://example.org, 1.2.3.4, 5.6.7.8" result = transform_extracted_indicators_command(args) assert result.outputs == expected_output assert result.readable_output == expected_readable_output def test_transform_extracted_indicators_command_with_empty_extracted_indicators(): """ Test the transform_extracted_indicators_command function with empty ExtractedIndicators argument. Given: - Empty ExtractedIndicators argument When: - Calling `transform_extracted_indicators_command` function Then: - Raise ValueError with proper error message. """ with pytest.raises(ValueError, match="ExtractedIndicators not specified"): transform_extracted_indicators_command({"ExtractedIndicators": ""})