示例#1
0
def test_create_issue_command_after_fix_mandatory_args_issue(mocker):
    from JiraV2 import create_issue_command
    mocker.patch.object(demisto, 'args', return_value=integration_args)
    user_data = {
        "self":
        "https://demistodev.atlassian.net/rest/api/2/user?accountId=1234",
        "accountId": "1234",
        "emailAddress": "*****@*****.**",
        "displayName": "test",
        "active": True,
        "timeZone": "Asia/Jerusalem",
        "locale": "en_US",
        "groups": {
            "size": 1,
            "items": []
        },
        "applicationRoles": {
            "size": 1,
            "items": []
        },
        "expand": "groups,applicationRoles",
        "projects": [{
            'id': '1234',
            'key': 'testKey',
            'name': 'testName'
        }]
    }
    mocker.patch('JiraV2.jira_req', return_value=user_data)
    mocker.patch.object(demisto, "results")
    create_issue_command()
    assert demisto.results.call_count == 1
示例#2
0
def test_create_issue_command_before_fix_mandatory_args_summary_missing(mocker, args):
    mocker.patch.object(demisto, 'args', return_value=args)
    from JiraV2 import create_issue_command
    with pytest.raises(Exception) as e:
        # when there are missing arguments, an Exception is raised to the user
        create_issue_command()
    assert e
示例#3
0
def test_create_issue_command_before_fix_mandatory_args_summary_missing(mocker, args):
    mocker.patch.object(demisto, 'args', return_value=args)
    mocker.patch.object(demisto, "results")
    from JiraV2 import create_issue_command
    with pytest.raises(SystemExit) as e:
        # when there are missing arguments, an Exception is raised to the user
        create_issue_command()
    assert e
    assert demisto.results.call_args[0][0]['Contents'] == \
           'You must provide at least one of the following: project_key or project_name'