예제 #1
0
def test_fields_with_multiple_word_display_name():
    """
        list all fields whose display name is a multiple word string
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    sfs = jp.getStandardFields(PROJECT_KEY_1, 'Bug')
    cfs = jp.getCustomFields(PROJECT_KEY_1, 'Bug')

    standard_multi_word_fields = [fn for fn in sfs if fn.count(' ') > 0]
    custom_multi_word_fields = [fn for fn in cfs if fn.count(' ') > 0]
    assert len(standard_multi_word_fields) > 0
    assert len(custom_multi_word_fields) > 0

    multi_word_bug_fields = """Advent Category,
        Affects Version/s,
        Due Date,
        Issue Type,
        Rally Creation Date,
        RallyID,
        RallyItem,
        Story Points,
        Target Release,
        Time Tracking
       """.split(',')

    assert 'Rally Creation Date' in custom_multi_word_fields
예제 #2
0
def test_get_custom_field_names_for_project():
    """
        returns an array of custom field names for a valid project name
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)

    #custom_field_names = jp.getCustomFields(PROJECT_NAME_1, "Story")
    custom_field_names = jp.getCustomFields(PROJECT_NAME_1, "Bug")
    assert "RallyID" in custom_field_names
예제 #3
0
def test_get_custom_field_names_list():
    """
        will return an array of custom field names
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)

    #custom_field_names = jp.getCustomFields(PROJECT_KEY_1, "Story")
    custom_field_names = jp.getCustomFields(PROJECT_KEY_1, "Bug")
    assert "RallyID" in custom_field_names
예제 #4
0
def test_bad_proj_ident_raises_error():
    """
        attempt to get custom fields using a bad project identifier will raise an error
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)

    with py.test.raises(JiraProxyError) as excinfo:
        custom_field_names = jp.getCustomFields(BAD_PROJECT_KEY_1, "Story")
    actualErrorMessage = excErrorMessage(excinfo)
    assert actualErrorMessage == f'Could not find project for identifier: {BAD_PROJECT_KEY_1}'
예제 #5
0
def test_valid_project_has_custom_fields():
    """
        should correctly identify that a known custom field exists for a valid project name
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    cfs = jp.getCustomFields(PROJECT_NAME_1, 'Bug')
    assert "RallyItem" in cfs
    assert jp.fieldExists(PROJECT_NAME_1, "Bug", "RallyID")

    jp2 = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    assert jp2.isCustomField(PROJECT_NAME_1, "Bug", "RallyURL")
예제 #6
0
def test_for_known_custom_field():
    """
        correctly identify that a known custom field exists
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    cfs = jp.getCustomFields(PROJECT_KEY_1, 'Bug')
    assert "RallyItem" in cfs
    assert jp.fieldExists(PROJECT_KEY_1, "Bug", "RallyID")

    jp2 = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    assert jp2.isCustomField(PROJECT_KEY_1, "Bug", "RallyURL")
예제 #7
0
def test_sad_bad_project_prevents_seeing_custom_field():
    """
        raises an error on attempt to identify that a known custom field 
        exists with an invalid project identifier
    """
    jp = JiraProxy(GOOD_VANILLA_SERVER_CONFIG)
    cfs = jp.getCustomFields(PROJECT_KEY_1, 'Bug')
    assert "RallyItem" in cfs
    assert jp.fieldExists(PROJECT_KEY_1, "Bug", "RallyID")
    with py.test.raises(JiraProxyError) as excinfo:
        trvth = jp.isCustomField(BAD_PROJECT_KEY_1, "Bug", "RallyURL")
    actualErrorMessage = excErrorMessage(excinfo)
    assert 'Could not find project for identifier:' in actualErrorMessage
예제 #8
0
def main(args):
    if len(args) != 2:
        sys.stderr.write(
            "ERROR: The Jira project key and issue type name must be provided")
        sys.exit(1)
    jira = JiraProxy(REG_USER_CONFIG)

    project_key, issue_type = "JIRPA", "Story"  #  or args[:2]
    print(f'\n Project: {project_key}   Issue type: {issue_type}')
    print("   Fields\n   ---------------")

    for field_name in reorder(jira.getStandardFields(project_key, issue_type)):
        print(f"   {field_name}")
    print("")

    for field_name in sorted(jira.getCustomFields(project_key, issue_type)):
        print(f"   {field_name}")
    print("")