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


Python Rally.addCollectionItems方法代码示例

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


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

示例1: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import addCollectionItems [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, apikey, workspace, project = rallyWorkset(options)
    #rally = Rally(server, user, password, apikey=apikey, workspace=workspace)
    rally = Rally(server, user, password, workspace=workspace, project=project)
    rally.enableLogging("rally.history.addtags")

    if len(args) < 2:
        print(USAGE)
        sys.exit(1)

    story_id = args.pop(0)
    tag_names = args[:]
    tags = []

    story = rally.get('Story', fetch="FormattedID,Name,Description,Tags", 
                       query="FormattedID = %s" % story_id,
                       server_ping=False, isolated_workspace=True, instance=True)

    response = rally.get('Tag', fetch="true", order="Name", server_ping=False, isolated_workspace=True)
    for tag in response:
        print("Workspace %s  has tag: %-14.14s created on %s  Name: %s"  % \
              (tag.Workspace.Name, tag.oid, tag.CreationDate[:-5].replace('T', ' '), tag.Name))

        if tag.Name in tag_names:
            tags.append(tag)

    print("=====================================================")
    print(", ".join([tag.Name for tag in tags]))

    adds = rally.addCollectionItems(story, tags)
    print(adds)

    droppable_tags = [tag for tag in tags if tag.Name == VICTIM_TAG_NAME]
    print("dropping Tags %s ..." % ", ".join([tag.Name for tag in droppable_tags]))

    drops = rally.dropCollectionItems(story, droppable_tags)
    if drops.errors:
        print("Problem attempting to drop tags: %s" % drops.errors)
        sys.exit(2)

    story = rally.get('Story', fetch="FormattedID,Name,Description,Tags", 
                       query="FormattedID = %s" % story_id,
                       server_ping=False, isolated_workspace=True, instance=True)
    #print(story.details())
    print "story tags after deleting the '%s' Tag" % (droppable_tags[0].Name)

    story_tags = [str(tag.Name) for tag in story.Tags]
    print(story_tags)
开发者ID:amcolosk,项目名称:RallyRestToolkitForPython,代码行数:52,代码来源:addtags.py


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