CloseTaskSetContext

Close a task with the closeComplete command, but then also add the "comments" to the incident context.

python · xMatters

Details

IDCloseTaskSetContext
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10116658
TagsUtilities

README

Closes a task with the taskComplete command, then returns the context

Script Data


Name Description
Script Type python
Tags utility

Dependencies


This script uses the following commands and scripts.

  • taskComplete

Inputs


Argument Name Description
entry_id The tag or Task ID to close
context_key The incident context key to add the comments to
comments The comments to be added to the incident context

Outputs


There are no outputs for this script.

# Test runner for CloseTaskSetContext

import demistomock as demisto
from CloseTaskSetContext import main


def test_close_task_set_context(mocker):
    demisto.log("stuff")

    def executeCommand(name, args=None):
        if name == "taskComplete":
            # Success
            return {}
        else:
            raise ValueError(f"Unimplemented command called: {name}")

    mocker.patch.object(
        demisto,
        "args",
        return_value={"entry_id": "waiter", "context_key": "XMatters.UserResponseOut", "comments": "This is a comment"},
    )

    # mocker.patch.object(demisto, 'executeCommand', side_effect=executeCommand)
    mocker.patch.object(demisto, "results")

    main()

    # If we got here we're good.
    assert True