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


Python Rally.addAttachment方法代码示例

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


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

示例1: test_add_tcr_attachment

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import addAttachment [as 别名]
def test_add_tcr_attachment():
    """
        Add an Attachment to a TestCaseResult item

        Create a TestCase, save a reference
        Create a TestCaseResult to be associated with the TestCase
        Create an attachment
        Attach the Attachment to the TestCaseResult item
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    wksp = rally.getWorkspace()
    assert wksp.Name == DEFAULT_WORKSPACE

    response = rally.get('Project', fetch=False, limit=10)
    assert response != None
    assert response.status_code == 200
    proj = rally.getProject()  # proj.Name == Sample Project
    assert proj.Name == 'Sample Project'

    tc_info = { "Workspace"    : wksp.ref,
                "Project"      : proj.ref,
                "Name"         : "Heat exposure",
                "Type"         : "Functional",
              }
    test_case = rally.create('TestCase', tc_info)
    assert int(test_case.oid) > 0

    tcr_info = { "Workspace" : wksp.ref,
                 "TestCase"  : test_case.ref,
                 "Date"      : "2016-05-17T14:30:28.000Z",
                 "Build"     : 17,
                 "Verdict"   : "Pass"
               }
    tcr = rally.create('TestCaseResult', tcr_info)
    assert int(tcr.oid) > 0

    attachment_name = "Addendum.txt"
    att_ok = conjureUpAttachmentFile(attachment_name)
    assert att_ok == True

    att = rally.addAttachment(tcr, attachment_name)
    assert att.Name == attachment_name
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:44,代码来源:test_attachments.py

示例2: test_add_attachment

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import addAttachment [as 别名]
def test_add_attachment():
    """
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    # find a Project with some US artifacts
    # pick one with no attachments
    # create an attachment file (or choose a smallish file with a commonly used suffix)
    # create the attachment in Rally and link it to the US artifact

    wksp = rally.getWorkspace()
    assert wksp.Name == DEFAULT_WORKSPACE

    response = rally.get('Project', fetch=False, limit=10)
    assert response != None
    assert response.status_code == 200

    proj = rally.getProject()  # proj.Name == DEFAULT_PROJECT
    assert proj.Name == DEFAULT_PROJECT

    #response = rally.get("UserStory", fetch="FormattedID,Name,Attachments")
    #for story in response:
    #    print "%s %-48.48s %d" % (story.FormattedID, story.Name, len(story.Attachments))

    candidate_story = "US1" #  was "US96" in trial
    response = rally.get("UserStory", fetch="FormattedID,Name,Attachments", 
                                   query='FormattedID = "%s"' % candidate_story)
  ##print(response.resultCount)
    story = response.next()
    assert len(story.Attachments) == 0

    attachment_name = "Addendum.txt"
    att_ok = conjureUpAttachmentFile(attachment_name)
    assert att_ok == True

    att = rally.addAttachment(story, attachment_name)
    assert att.Name == attachment_name

    response = rally.get("UserStory", fetch="FormattedID,Name,Attachments", 
                                   query='FormattedID = "%s"' % candidate_story)
    story = response.next()
    assert len(story.Attachments) == 1
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:43,代码来源:test_attachments.py

示例3: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import addAttachment [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, version="1.30")  # specify the Rally server and credentials
    rally.enableLogging('rally.hist.creattach') # name of file you want logging to go to

    if len(args) != 2:
        errout('ERROR: You must supply an Artifact identifier and an attachment file name')
        errout(USAGE)
        sys.exit(1)

    target, attachment_file_name = args
    artifact = validateTarget(rally, target)

    me = rally.getUserInfo(username=user).pop(0)
    #print "%s user oid: %s" % (user, me.oid)

    att = rally.addAttachment(artifact, attachment_file_name)
    print "created Attachment: %s for %s" % (attachment_file_name, target)
开发者ID:M1ntcraft3r,项目名称:RallyRestToolkitForPython,代码行数:23,代码来源:creattach.py

示例4: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import addAttachment [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    if len(args) != 2:
        errout('ERROR: You must supply an Artifact identifier and an attachment file name')
        errout(USAGE)
        sys.exit(1)
    target, attachment_file_name = args

    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging('rally.hist.creattach') # name of file you want logging to go to

    artifact = validateTarget(rally, target)

    me = rally.getUserInfo(username=user).pop(0)
    #print "%s user oid: %s" % (user, me.oid)

    att = rally.addAttachment(artifact, attachment_file_name)
    print "created Attachment: %s for %s" % (attachment_file_name, target)
开发者ID:Cyrilplus,项目名称:RallyRestToolkitForPython,代码行数:25,代码来源:creattach.py


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