StopScheduledTask

This stops the scheduled task whose ID is given in the taskID argument.

python · Common Scripts

Details

IDStopScheduledTask
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10404775
TagsUtility

README

Stops the scheduled task whose ID is given in the taskID argument.

Script Data


Name Description
Script Type python
Tags Utility

Inputs


Argument Name Description
taskID The ID of the schedule to stop.

Outputs


There are no outputs for this script.

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


def test_stop_scheduled_task(mocker):
    import StopScheduledTask

    demisto_execute_mock = mocker.patch.object(
        demisto, "executeCommand", return_value=[{"Type": EntryType.NOTE, "ContentFormats": EntryFormat.TEXT, "Contents": ""}]
    )

    args = {"taskID": "100"}
    StopScheduledTask.stop_scheduled_task(args)

    execute_command_args = demisto_execute_mock.call_args_list[0][0]
    assert demisto_execute_mock.call_count == 1
    assert execute_command_args[0] == "scheduleEntry"
    assert execute_command_args[1] == {"cancel": "cancel", "id": "100"}