当前位置: 首页>>代码示例>>Python>>正文


Python Rally.getAllowedValues方法代码示例

本文整理汇总了Python中pyral.Rally.getAllowedValues方法的典型用法代码示例。如果您正苦于以下问题:Python Rally.getAllowedValues方法的具体用法?Python Rally.getAllowedValues怎么用?Python Rally.getAllowedValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyral.Rally的用法示例。


在下文中一共展示了Rally.getAllowedValues方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_getAllowedValues_for_UserStory_Milestone

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAllowedValues [as 别名]
def test_getAllowedValues_for_UserStory_Milestone():
    """
        Using a known valid Rally server and known valid access credentials,
        request allowed value information for the Milestones field of the UserStory entity.
        The Milestones field is a standard field of schema type COLLECTION whose value
        is entirely context dependent on the specific artifact so getting allowed values
        doesn't really make sense in the same way as an attribute like State or Severity
        that has a finite set of possible values that are the same for every Story or Defect
        in the workspace.  Because of that characteristic, we return a list with a single True
        value ( [True] ) to designate that yes, technically the Milestones field has allowed
        values but that asking for them on a specific AC artifact short-circuits.  The proper
        way to get all of the AllowedValues for Milestones is to query the Milestone entity 
        itself.  There are numerous other standard attributes
        with the same sort of semantic that are excluded from chasing the COLLECTION url and
        returning some list of values.  (like, Changesets, Discussions, Tags, etc.)
    """
    rally = Rally(server=AGICEN, apikey=API_KEY)

    avs = rally.getAllowedValues('Story', 'Milestones')
    assert avs == [True]

    response = rally.get('Milestone', fetch=True, workspace=LARGE_WORKSPACE,
                           project=LARGE_PROJECT_TREE_BASE, projectScopeDown=True)
    milestones = [item for item in response]
    assert len(milestones) > 150

    # Given the singular name of the target field (which is invalid...) return a None value
    avs = rally.getAllowedValues('Story', 'Milestone')
    assert avs is None
开发者ID:amcolosk,项目名称:RallyRestToolkitForPython,代码行数:31,代码来源:test_allowed_values.py

示例2: test_getAllowedValues_for_custom_collections_field_Defect

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAllowedValues [as 别名]
def test_getAllowedValues_for_custom_collections_field_Defect():
    rally = Rally(server=AGICEN, apikey=API_KEY, workspace='Rally', project='Rally')
    avs = rally.getAllowedValues('Defect', 'MobileOS')
    assert len(avs) > 0
    target_value = 'Android'
    assert len([v for v in avs if v == target_value]) == 1

    pavs = rally.getAllowedValues('Defect', 'RootCause')
    assert [av for av in pavs if av == 'Implementation']
    assert [av for av in pavs if av == 'Performance']
    assert [av for av in pavs if av == 'Usability']
开发者ID:amcolosk,项目名称:RallyRestToolkitForPython,代码行数:13,代码来源:test_allowed_values.py

示例3: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAllowedValues [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, user, password, workspace, project = rallySettings(options)
    print " ".join(["|%s|" % item for item in [server, user, '********', workspace, project]])
    rally = Rally(server, user, password, workspace=workspace, project=project)
    rally.enableLogging('rally.hist.statecount')  # name of file you want logging to go to

    if not args:
        errout(USAGE)
        sys.exit(1)

    rally.setWorkspace(workspace)
    rally.setProject(project)

    artifact_type = args[0]
    if artifact_type not in VALID_ARTIFACT_TYPES:
        errout(USAGE)
        errout('The artifact_type argument must be one of: %s\n' % ", ".join(VALID_ARTIFACT_TYPES))
        sys.exit(1)
        
    art_type = artifact_type[:]
    state = 'State'  # default to this and change below if necessary
    if artifact_type in ['Story', 'UserStory', 'HierarchicalRequirement']:
        artifact_type = 'HierarchicalRequirement'
        state = 'ScheduleState'

    t_zero = time.time()
    state_values = rally.getAllowedValues(artifact_type, state)
    t_one = time.time()
    av_time = t_one - t_zero

    show_counts(rally, artifact_type, state, state_values, av_time)
开发者ID:bimsapi,项目名称:RallyRestToolkitForPython,代码行数:35,代码来源:statecounts.py

示例4: test_getAllowedValues_query

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAllowedValues [as 别名]
def test_getAllowedValues_query():
    """
        Using a known valid Rally server and known valid access credentials,
        request allowed value information for the State field of the Defect entity.
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    avs = rally.getAllowedValues('Defect', 'State')
    assert len(avs) > 0
    assert len(avs) >= 4
    assert 'Open' in avs
    assert 'Closed' in avs

    avs = rally.getAllowedValues('Defect', 'PrimaryColor')
    assert len(avs) > 0
    assert len(avs) >= 6 and len(avs) <= 8
    assert 'Red' in avs
    assert 'Magenta' in avs
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:19,代码来源:test_convenience.py

示例5: test_getAllowedValues_for_UserStory

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAllowedValues [as 别名]
def test_getAllowedValues_for_UserStory():
    """
        Using a known valid Rally server and known valid access credentials,
        request allowed value information for the Milestones field of the UserStory entity.
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    avs = rally.getAllowedValues('Story', 'Milestones')
    assert len(avs) == 1
    assert avs == [True]
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:11,代码来源:test_convenience.py

示例6: test_allowed_values_query

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAllowedValues [as 别名]
def test_allowed_values_query():
    """
        Using a known valid Rally server and known valid access credentials,
        request allowed value information for the State field of the Defect entity.
    """
    rally = Rally(server=PREVIEW, user=PREVIEW_USER, password=PREVIEW_PSWD)
    avs = rally.getAllowedValues('Defect', 'State')
    assert len(avs) > 0
    assert len(avs) == 4
    assert u'Open' in avs
    assert u'Closed' in avs
开发者ID:lenciel,项目名称:pyral,代码行数:13,代码来源:test_convenience.py

示例7: test_allowed_values_query

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAllowedValues [as 别名]
def test_allowed_values_query():
    """
        Using a known valid Rally server and known valid access credentials,
        request allowed value information for the State field of the Defect entity.
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    avs = rally.getAllowedValues('Defect', 'State')
    #for av in avs.values():
    #    print "%s" % av
    assert len(avs) > 0
    assert len(avs) == 6
    assert u'Open' in avs
    assert u'Closed' in avs
开发者ID:Streeter1981,项目名称:RallyRestToolkitForPython-master,代码行数:15,代码来源:test_convenience.py

示例8: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAllowedValues [as 别名]
def main(args):

    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    entity = args.pop(0)
    attributes  = args
    server, user, password, apikey, workspace, project = rallyWorkset(options)
    print(" ".join(["|%s|" % item for item in [server, user, password, apikey, workspace, project]]))

    #rally = Rally(server, user, password, apikey=apikey, workspace=workspace, project=project, server_ping=False)
    rally = Rally(server, user, password, apikey=apikey,server_ping=False)
    #rally.enableLogging('rally.hist.avl')  # name of file you want the logging to go to

    target = entity
    if entity in ['Story', 'User Story', 'UserStory']:
        entity = "HierarchicalRequirement"
        target = entity
    mo = CAMEL_CASED_NAME_PATT.search(entity)
    if mo:
        txfm = re.sub(CAMEL_CASED_NAME_PATT, r'\1 \2', entity)
        print('transforming query target "%s" to "%s"' % (entity, txfm))
        entity = txfm

    print("%s" % entity)

    response = rally.get('TypeDefinition', fetch="Name,Attributes", query='Name = "%s"' % entity)
    # could check for response.errors here...
    if response.errors:
        print("Errors: %s" % response.errors)
    if response.warnings:
        print("Warnings: %s" % response.warnings)
    td = response.next()

    std_attributes    = sorted([attr for attr in td.Attributes if attr.ElementName[:2] != 'c_'], key=lambda x: x.ElementName)
    custom_attributes = sorted([attr for attr in td.Attributes if attr.ElementName[:2] == 'c_'], key=lambda x: x.ElementName)
    all_attributes = std_attributes + custom_attributes
    for attribute in all_attributes:
        attr_name = attribute.Name.replace(' ', '')
        if attributes and attr_name not in attributes:
            continue

        if attribute.AttributeType not in ['STATE', 'RATING', 'STRING', 'COLLECTION']:
            continue

        allowed_values = rally.getAllowedValues(target, attr_name)
        if allowed_values:
            print("    %-28.28s    (%s)" % (attr_name, attribute.AttributeType))
            for av in allowed_values:
                print("        |%s|" % av)
开发者ID:amcolosk,项目名称:RallyRestToolkitForPython,代码行数:51,代码来源:allowedValues.py


注:本文中的pyral.Rally.getAllowedValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。