Пример #1
0
def test_get_comments_list_for_specific_issue_id():
    """
        get a list of comments with the getComments method given an issue id
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)

    target_issue_key = f'{PROJECT_KEY_1}-2'
    target_issue = jp.getIssue(target_issue_key)
    assert target_issue
    comments = jp.getComments(target_issue_key)
    for comment in comments:
        cmt_id = comment['id']
        status, result, errors = jp.jira_comm.deleteRequest(
            f'issue/{target_issue_key}/comment/{cmt_id}')
        if errors:
            raise Exception('Unable to delete a comment from the target issue')

    comments = jp.getComments(target_issue_key)
    assert len(comments) == 0

    test_comment = 'A comment to be tested.'
    jp.addComment(target_issue_key, test_comment)

    comments = jp.getComments(target_issue_key)
    assert len(comments) == 1
    assert comments[0]["body"] == test_comment

    another_comment = 'Winds slips swiftly through the leafless branches'
    jp.addComment(target_issue_key, another_comment)
    comments = jp.getComments(target_issue_key)
    assert len(comments) == 2
    assert comments[1]["body"] == another_comment
Пример #2
0
def test_decent_error_message_for_getComments_when_issue_key_nonexistent():
    """
        Error message should be useful when key does nt exist in getComments
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    work_item = {"Summary": "Comments about games."}
    issue_key = jp.createIssue(PROJECT_KEY_1, "Bug", work_item)
    jp.deleteIssue(issue_key)

    with py.test.raises(JiraProxyError) as excinfo:
        jp.getComments(issue_key)
    actualErrorMessage = excErrorMessage(excinfo)
    assert 'Issue Does Not Exist' in actualErrorMessage
Пример #3
0
def test_use_addComment_method_for_specific_issue():
    """
        should be able to add a comment with the addComment method 
        given an issue id and comment text
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    work_item = {"Summary": "Comments about games."}
    issue_key = jp.createIssue(PROJECT_KEY_1, "Bug", work_item)

    comment_1 = "Foursquare is a great game"

    jp.addComment(issue_key, comment_1)
    comments = jp.getComments(issue_key)
    assert len(comments) == 1
    assert comments[0]["body"] == comment_1

    assert jp.deleteIssue(issue_key)
Пример #4
0
def test_add_two_comments_to_an_issue():
    """
        should be able to add two comments with the addComment method 
        given an issue id and comment text
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    work_item = {"Summary": "Comments about games."}
    issue_key = jp.createIssue(PROJECT_KEY_1, "Bug", work_item)

    comment_1 = "Foursquare is a great game"
    comment_2 = "Risk is a fun board game"

    jp.addComment(issue_key, comment_1)
    jp.addComment(issue_key, comment_2)
    comments = jp.getComments(issue_key)
    assert len(comments) == 2
    assert comments[0]["body"] == comment_1
    assert comments[1]["body"] == comment_2