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


Python Rally.create方法代码示例

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


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

示例1: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import create [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, 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.add_tcrs")

    if len(args) < 2:
        errout(USAGE)
        sys.exit(1)
    test_case_id, tcr_info_filename = args
    if not os.path.exists(tcr_info_filename):
        errout("ERROR:  file argument '%s' does not exist.  Respecify using corrent name or path\n" % tcr_info_filename)
        errout(USAGE)
        sys.exit(2)
    try:
        with open(tcr_info_filename, 'r') as tcif:
            content = tcif.readlines()
        tcr_info = []
        # each line must have Build, Date, Verdict
        for ix, line in enumerate(content):
            fields = line.split(',')
            if len(fields) != 3:
                raise Exception('Line #%d has invalid number of fields: %s' % (ix+1, repr(fields)))
            tcr_info.append([field.strip() for field in fields])
    except Exception:
        errout("ERROR: reading file '%s'.  Check the permissions or the content format for correctness." % tcr_info_filename)
        errout(USAGE)
        sys.exit(2)

    test_case = rally.get('TestCase', query="FormattedID = %s" % test_case_id,
                          workspace=workspace, project=None, instance=True)
    if not test_case or hasattr(test_case, 'resultCount'):
        print "Sorry, unable to find a TestCase with a FormattedID of %s in the %s workspace" % \
              (test_case_id, workspace)
        sys.exit(3)

    wksp = rally.getWorkspace()

    for build, run_date, verdict in tcr_info:
        tcr_data = { "Workspace" : wksp.ref,
                     "TestCase"  : test_case.ref,
                     "Build"     : build,
                     "Date"      : run_date,
                     "Verdict"   : verdict
                   }
        try:
            tcr = rally.create('TestCaseResult', tcr_data)
        except RallyRESTAPIError, details:
            sys.stderr.write('ERROR: %s \n' % details)
            sys.exit(4)
        
        print "Created  TestCaseResult OID: %s  TestCase: %s  Build: %s  Date: %s  Verdict: %s" % \
               (tcr.oid, test_case.FormattedID, tcr.Build, tcr.Date, tcr.Verdict)
开发者ID:Cyrilplus,项目名称:RallyRestToolkitForPython,代码行数:59,代码来源:add_tcrs.py

示例2: test_post_pull_request

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import create [as 别名]
def test_post_pull_request():
    expectedErrMsg = '422 Requested type name "pullrequest" is unknown.'
    #rally = Rally(server=TESTN, user=TESTN_USER, password=TESTN_PSWD)
    #rally = Rally(server=AGICEN, user=AGICEN_USER, password=AGICEN_PSWD)
    rally = Rally(server=AGICEN, apikey=AGICEN_SUB_100_API_KEY)
    #with py.test.raises(RallyRESTAPIError) as excinfo:
    pr = rally.create('PullRequest', dummy_data, project=None)
    assert pr is not None
    assert pr.oid
开发者ID:amcolosk,项目名称:RallyRestToolkitForPython,代码行数:11,代码来源:test_pull_request_copied.py

示例3: test_add_tcr_attachment

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import create [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

示例4: test_mep_project_in_request_payload

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import create [as 别名]
def test_mep_project_in_request_payload():
    """
        Using a known valid Rally server and known valid access credentials,
        obtain a Rally instance associated with a unique Project name within a
        valid Workspace.
        Assemble a payload dict to be used in creating a BuildDefinition item
        that uses a m-e-p Project value for the Project attribute.
        Issue the request to create the BuildDefinition item.
        The result should be the creation of the BuildDefinition item
        for which the Project attribute has a ref to the targeted m-e-p Project.
    """
    rally = Rally(server=TRIAL, user=YETI_USER, password=YETI_PSWD,
                  workspace=BOONDOCKS_WORKSPACE, project=BOONDOCKS_PROJECT)
    workspace = rally.getWorkspace()
    dd_project = rally.getProject(DEEP_DUPE)
    info = {
        'Name'         : 'Throckmorton Nunnigan',
        'Description'  : 'A completely artificial sweetener',
        'Workspace'    : workspace._ref,
        'Project'      : dd_project._ref
    }

    build_defn = rally.create('BuildDefinition', info)
    assert build_defn.Project._ref == dd_project._ref
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:26,代码来源:test_project_pathing.py

示例5: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import create [as 别名]

#.........这里部分代码省略.........
    # Get a handle to Rally Project
    proj = rally.getProject()

    # Jira Severity to Rally Severity Lookup
    jira2rally_sev_lookup = { 
                             "Critical" : "Crash/Data Loss",
                             "Severe" : "Crash/Data Loss",
                             "Major" : "Major Problem",
                             "Minor" : "Minor Problem","Cosmetic":"Cosmetic",
                             "Trivial" : "Cosmetic",
                             "None" : "Minor Problem" 
                             }

    # Column name to index mapping
    column_name_index_lookup = {0 : 'Summary',
                                1 : 'Priority',
                                2 : 'Severity',
                                3 : 'State',
                                4 : 'Description',
                                5 : 'Assignee',
                                6 : 'Submitter',
                                7 : 'RallyStoryID',
                                8 : 'JiraID'}

    # get the first user whose DisplayName is 'Mark Williams'
    user = rally.getUserInfo(name='Mark Williams').pop(0)

    rownum = 0
    for row in bugsreader:
        # Save header row.
        if rownum == 0:
            header = row
        else:
            print "Importing Defect count %d" % (rownum)
            colnum = 0
            for col in row:
                column_name = column_name_index_lookup[colnum]
                if column_name == "Summary":
                    summary = col
                elif column_name == "Priority":
                    priority = col
                elif column_name == "Severity":
                    severity = jira2rally_sev_lookup[col]
                elif column_name == "State":
                    state = col
                elif column_name == "Description":
                    desc = col
                elif column_name == "Assignee":
                    owner = rally.getUserInfo(name=col).pop(0)
                elif column_name == "Submitter":
                    submitted_by = rally.getUserInfo(name=col).pop(0)
                elif column_name == "RallyStoryID":
                    story_formatted_id = col
                elif column_name == "JiraID":
                    jira_id = col
                colnum += 1

            # Find the story to parent to in Rally
            query_criteria = 'FormattedID = "%s"' % story_formatted_id
            response = rally.get('Story', fetch=True, query=query_criteria)
            if response.errors:
                sys.stdout.write("\n".join(errors))
                sys.exit(1)
                
            defect_data = { 
                "Project"       : proj.ref,
                "Name"          : summary,
                "Priority"      : priority,
                "Severity"      : severity,
                "State"         : state,
                "Description"   : desc,
                "ScheduleState" : "Defined",
                "Owner"         : owner.ref,
                "SubmittedBy"   : submitted_by.ref,
                "JiraID"        : jira_id }

            if response.resultCount == 0:
                print "No Story %s found in Rally - No Parent will be assigned." % (story_formatted_id)
            else:
                print "Story %s found in Rally - Defect will be associated." % (story_formatted_id)
                story_in_rally = response.next()
                defect_data = { 
                    "Project"       : proj.ref,
                    "Name"          : summary,
                    "Priority"      : priority,
                    "Severity"      : severity,
                    "State"         : state,
                    "Description"   : desc,
                    "ScheduleState" : "Defined",
                    "Owner"         : owner.ref,
                    "SubmittedBy"   : submitted_by.ref,
                    "Requirement"   : story_in_rally.ref,
                    "JiraID"        : jira_id }
            try:
                defect = rally.create('Defect', defect_data)
            except Exception, details:
                sys.stderr.write('ERROR: %s \n' % details)
                sys.exit(1)
            print "Defect created, ObjectID: %s  FormattedID: %s" % (defect.oid, defect.FormattedID)
        rownum += 1
开发者ID:markwilliams970,项目名称:pyral-import-defects,代码行数:104,代码来源:import_defects.py

示例6: AgileCentralConnection

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import create [as 别名]

#.........这里部分代码省略.........
        for proj in response:
            if proj.Name not in self.project_bucket:
                self.project_bucket[proj.Name] = 0
            self.project_bucket[proj.Name] += 1
        self.duplicated_project_names = [p for p,c in self.project_bucket.items() if c != 1]

        project_names = [proj.Name for proj in response]
##        after = time.time()
##        print("after  call to agicen get Project: %s" % after)
##        print("agicen.get Project  elapsed time: %6.3f  seconds  for  %d Projects" % ((after - before), len(project_names)))
##        print("")
        self.log.info("    %d sub-projects" % len(project_names))

        return True


    def disconnect(self):
        """
            Just reset our agicen instance variable to None
        """
        self.agicen = None


    def set_integration_header(self, header_info):
        self.integration_name    = header_info['name']
        self.integration_vendor  = header_info['vendor']
        self.integration_version = header_info['version']
        if 'other_version' in header_info:
            self.integration_other_version = header_info['other_version']


    def getRecentBuilds(self, ref_time, projects):
        """
            Obtain all Builds created in Agile Central at or after the ref_time parameter
            (which is a struct_time object)
             in Python, ref_time will be a struct_time item:
               (tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst)
        """
        ref_time_readable = time.strftime("%Y-%m-%d %H:%M:%S Z", ref_time)
        ref_time_iso      = time.strftime("%Y-%m-%dT%H:%M:%SZ",  ref_time)
        self.log.info("Detecting recently added Agile Central Builds")
        selectors = ['CreationDate >= %s' % ref_time_iso]
        log_msg = '   recent Builds query: %s' %  ' and '.join(selectors)
        self.log.info(log_msg)
        builds = {}

        for project in projects:
            response = self._retrieveBuilds(project, selectors)
            log_msg = "  %d recently added Agile Central Builds detected for project: %s"
            self.log.info(log_msg % (response.resultCount, project))

            for build in response:
                build_name = build.BuildDefinition.Name
                if project not in builds:
                    builds[project] = {}
                if build_name not in builds[project]:
                    builds[project][build_name] = []
                builds[project][build_name].append(build)
        return builds


    def _retrieveBuilds(self, project, selectors):
        fetch_fields = "ObjectID,CreationDate,Number,Start,Status,Duration,BuildDefinition,Name," +\
                       "Workspace,Project,Uri,Message,Changesets"
        try:
            response = self.agicen.get('Build',
开发者ID:klehman-rally,项目名称:bldeif,代码行数:70,代码来源:agicen_bld_connection.py


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