Example #1
0
def test_update_remote_system(mocker):
    """
    Given:
        - Information regarding a changed incident
    When
        - An incident was changed in Demisto
    Then
        - The remote system is updated and the incident id returns.
    """
    from JiraV2 import update_remote_system_command
    from test_data.expected_results import ARGS_FROM_UPDATE_REMOTE_SYS

    mocker.patch.object(demisto, "info")
    mocker.patch.object(demisto, "debug")
    mocker.patch.object(demisto, "getFilePath", return_value={"name": "file.png"})
    mocker.patch("JiraV2.edit_issue_command", return_value="")
    mocker.patch("JiraV2.upload_file", return_value="")
    mocker.patch("JiraV2.add_comment", return_value="")
    res = update_remote_system_command(ARGS_FROM_UPDATE_REMOTE_SYS)
    assert res == "17757"
Example #2
0
def test_update_remote_system_delta(mocker):
    """
    Given:
        - Information regarding a changed incident in XSOAR

    When:
        - An incident's summary was changed.

    Then:
        - The issue in Jira has the new summary.
    """
    from JiraV2 import update_remote_system_command

    mocker.patch("JiraV2.edit_issue_command", return_value="")
    mocker.patch.object(demisto, "info")
    mocker.patch.object(demisto, "debug")
    res = update_remote_system_command(
        {
            "incidentChanged": "17757",
            "remoteId": "17757",
            "delta": {"summary": "changes"},
        }
    )
    assert res == "17757"