PenfieldAssign
PenfieldAssign will use the Penfield.AI integration's penfield-get-assignee command to determine who an incident should be assigned to, then print the selected analyst to the War Room and overwrite the owner property.
python · PenfieldAI
Details
| ID | PenfieldAssign |
|---|---|
| Language | python |
| From Version | 6.0.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Tags | management user Utility |
README
PenfieldAssign will use the PenfieldGetAssignee integration to determine who an incident should be assigned to, then print the selected analyst to the War Room and overwrite the owner property.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | management, user, Utility |
| Cortex XSOAR Version | 5.5.0 |
Dependencies
This script uses the following commands and scripts.
- penfield-api-call
Inputs
| Argument Name | Description |
|---|---|
| assign | Whether this script should actually assign the incident by overwriting owner. Defaults to yes. |
Outputs
There are no outputs for this script.
Examples
!PenfieldAssign
!PenfieldAssign assign=’Yes’
!PenfieldAssign assign=’No’
Human Readable Output
incident assigned to: charles
"""Base Script for Cortex XSOAR - Unit Tests file Pytest Unit Tests: all funcion names must start with "test_" More details: https://xsoar.pan.dev/docs/integrations/unit-testing MAKE SURE YOU REVIEW/REPLACE ALL THE COMMENTS MARKED AS "TODO" """ import json import demistomock as demisto from PenfieldAssign import main, penfield_assign # from pytest import * def util_load_json(path): with open(path, encoding="utf-8") as f: return json.loads(f.read()) # DUMMY DATA fake_analyst_ids = "admin,person" fake_category = "fake_cat" fake_created = "fake_date" fake_id = "fake_id" fake_name = "fake_name" fake_severity = "Low" # TODO: REMOVE the following dummy unit test function fake_response = [{"Contents": "test_user"}] def test_penfield_assign(mocker): # this overwrite the command call mocker.patch.object(demisto, "executeCommand", return_value=fake_response) assert ( penfield_assign( analyst_ids=fake_analyst_ids, category=fake_category, created=fake_created, id=fake_id, name=fake_name, severity=fake_severity, ) == fake_response ) def test_main(mocker): mock_users = util_load_json("test_data/test_2_users.json") mock_incident = util_load_json("test_data/test_incident.json") # overwrite get users, incidents, and args mocker.patch.object(demisto, "executeCommand", return_value=mock_users) mocker.patch.object(demisto, "incidents", return_value=mock_incident) mocker.patch.object(demisto, "args", return_value={"assign": "No"}) mocker.patch("PenfieldAssign.penfield_assign", return_value=fake_response) mocker.patch.object(demisto, "results") main() assert demisto.results.call_args.args[0] == "penfield suggests: test_user"