Ejemplo n.º 1
0
def test_issue_query_command_no_issues(mocker):
    """
    Given
    - Jira issue query command

    When
    - Sending HTTP request and getting no issues from the query

    Then
    - Verify no error message is thrown to the user
    """
    from JiraV2 import issue_query_command
    mocker.patch('JiraV2.run_query', return_value={})
    human_readable, _, _ = issue_query_command('status=Open AND labels=lies')
    assert 'No issues matched the query' in human_readable
Ejemplo n.º 2
0
def test_issue_query_command_with_results(mocker):
    """
    Given
    - Jira issue query command

    When
    - Sending HTTP request and getting one issues from the query

    Then
    - Verify outputs
    """
    from JiraV2 import issue_query_command
    from test_data.raw_response import QUERY_ISSUE_RESPONSE
    from test_data.expected_results import QUERY_ISSUE_RESULT

    mocker.patch('JiraV2.run_query', return_value=QUERY_ISSUE_RESPONSE)
    _, outputs, _ = issue_query_command('status!=Open', max_results=1)
    assert outputs == QUERY_ISSUE_RESULT
Ejemplo n.º 3
0
def test_issue_query_command_with_custom_fields_with_results(
        mocker, requests_mock):
    """
    Given
    - Jira issue query command and extraFields parameters

    When
    - Sending HTTP request and getting one issues from the query

    Then
    - Verify outputs
    """
    from JiraV2 import issue_query_command
    from test_data.raw_response import QUERY_ISSUE_RESPONSE, EXPECTED_RESP
    from test_data.expected_results import QUERY_ISSUE_RESULT_WITH_CUSTOM_FIELDS
    requests_mock.get('https://localhost/rest/api/latest/search/',
                      json=QUERY_ISSUE_RESPONSE)
    mocker.patch("JiraV2.get_custom_field_names", return_value=EXPECTED_RESP)
    _, outputs, _ = issue_query_command("status!=Open",
                                        extra_fields="Owner",
                                        max_results=1)
    assert outputs == QUERY_ISSUE_RESULT_WITH_CUSTOM_FIELDS