示例#1
0
def create_version(jira_host, username, password, body):
    """
    Creates new version.

    jira_host -- JIRA host to contact.
    username -- JIRA username with administrative permissions.
    password -- password of the username.
    body -- new version body.
    """
    headers = get_auth_header(username, password)
    headers.update(get_content_type_header())
    response = https_helper.post(jira_host, version_path % '', body, headers)
    if response.status != 201:
        raise ValueError('Failed to create version: %s %s' % (response.status, response.reason))
示例#2
0
def create_version(jira_host, username, password, body):
    """
    Creates new version.

    jira_host -- JIRA host to contact.
    username -- JIRA username with administrative permissions.
    password -- password of the username.
    body -- new version body.
    """
    headers = get_auth_header(username, password)
    headers.update(get_content_type_header())
    response = https_helper.post(jira_host, version_path % '', body, headers)
    if response.status != 201:
        raise ValueError('Failed to create version: %s %s' %
                         (response.status, response.reason))
示例#3
0
def create_issue(jira_host, username, password, body):
    """
    Creates new JIRA issue

    jira_host -- JIRA host to contact.
    username -- JIRA username with administrative permissions.
    password -- password of the username.
    body -- JSON with new issue body
    """
    headers = get_auth_header(username, password)
    headers.update(get_content_type_header())
    response = https_helper.post(jira_host, issue_path % '', body, headers)
    if response.status != 201:
        raise ValueError('Failed to create issue: status={0}, reason={1}'.format(response.status, response.reason))
    return json.loads(response.read())
示例#4
0
def perform_transition(jira_host, username, password, issue_id, transition_id):
    """
    Performs transition on the specified issue.

    jira_host -- JIRA host to contact
    username -- JIRA username with administrative permissions.
    password -- password of the username.
    issue_id -- id of the issue which should be transitioned.
    transition_id -- id of the transition which should be performed.
    """
    headers = get_auth_header(username, password)
    headers.update(get_content_type_header())
    body = json.dumps({'transition': transition_id})
    response = https_helper.post(jira_host, issue_transitions_path % issue_id, body, headers)
    if response.status != 204:
        ValueError('Failed to perform transition on issue %s: %s %s' % (issue_id, response.status, response.reason))
示例#5
0
def create_issue(jira_host, username, password, body):
    """
    Creates new JIRA issue

    jira_host -- JIRA host to contact.
    username -- JIRA username with administrative permissions.
    password -- password of the username.
    body -- JSON with new issue body
    """
    headers = get_auth_header(username, password)
    headers.update(get_content_type_header())
    response = https_helper.post(jira_host, issue_path % '', body, headers)
    if response.status != 201:
        raise ValueError(
            'Failed to create issue: status={0}, reason={1}'.format(
                response.status, response.reason))
    return json.loads(response.read())
示例#6
0
def perform_transition(jira_host, username, password, issue_id, transition_id):
    """
    Performs transition on the specified issue.

    jira_host -- JIRA host to contact
    username -- JIRA username with administrative permissions.
    password -- password of the username.
    issue_id -- id of the issue which should be transitioned.
    transition_id -- id of the transition which should be performed.
    """
    headers = get_auth_header(username, password)
    headers.update(get_content_type_header())
    body = json.dumps({'transition': transition_id})
    response = https_helper.post(jira_host, issue_transitions_path % issue_id,
                                 body, headers)
    if response.status != 204:
        ValueError('Failed to perform transition on issue %s: %s %s' %
                   (issue_id, response.status, response.reason))