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


Python Rally.getWorkspace方法代码示例

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


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

示例1: test_default_wksprj_set_non_default_wksprj_specify_workspace_and_project_equal_None_context

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_default_wksprj_set_non_default_wksprj_specify_workspace_and_project_equal_None_context():
    rally = Rally(server=AGICEN, user=AGICEN_USER, password=AGICEN_PSWD)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    project = rally.getProject()
    assert project.Name == DEFAULT_PROJECT

    rally.setWorkspace(ALTERNATE_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == ALTERNATE_WORKSPACE

    #problem_text = 'Specified project not valid for your current workspace or credentials'
    #with py.test.raises(Exception) as excinfo:
    #    rally.setProject(ALTERNATE_PROJECT)
    #actualErrVerbiage = excinfo.value.args[0]  # becuz Python2.6 deprecates message :-(
    #assert excinfo.value.__class__.__name__ == 'Exception'
    #assert actualErrVerbiage == problem_text
    
    rally.setProject(ALTERNATE_PROJECT)
    project = rally.getProject()
    assert project.Name == ALTERNATE_PROJECT
    
    url = makeResourceUrl(rally, 'Defect', workspace=None, project=None)
    #print(url)
    assert '&workspace=' not in url
    assert '&project='   not in url
开发者ID:amcolosk,项目名称:RallyRestToolkitForPython,代码行数:28,代码来源:test_context.py

示例2: test_default_wksprj_with_set_non_default_workspace_context

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_default_wksprj_with_set_non_default_workspace_context():
    rally = Rally(server=AGICEN, user=AGICEN_USER, password=AGICEN_PSWD)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    project   = rally.getProject()
    assert project.Name == DEFAULT_PROJECT

    url = makeResourceUrl(rally, 'Defect')
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    expected_project_clause   = 'project=project/%s'     % str(project.oid)
    assert expected_workspace_clause in url
    assert expected_project_clause   in url

    rally.setWorkspace(ALTERNATE_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == ALTERNATE_WORKSPACE

    rally.setProject(ALTERNATE_PROJECT)
    project   = rally.getProject()
    assert project.Name == ALTERNATE_PROJECT

    url = makeResourceUrl(rally, 'Defect')
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    expected_project_clause   = 'project=project/%s'     % str(project.oid)
    assert expected_workspace_clause in url
    assert expected_project_clause   in url
开发者ID:amcolosk,项目名称:RallyRestToolkitForPython,代码行数:28,代码来源:test_context.py

示例3: test_get_default_workspace

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_get_default_workspace():
    """
        Using a known valid Rally server and known valid access credentials,
        and specifying the default workspace and project, verify that
        calling the getWorkspace method returns info for the default
        workspace.
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, workspace=DEFAULT_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
开发者ID:Cyrilplus,项目名称:RallyRestToolkitForPython,代码行数:15,代码来源:test_wksprj_setting.py

示例4: test_get_non_default_workspace

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_get_non_default_workspace():
    """
        Using a known valid Rally server and known valid access credentials,
        and specifying the default workspace and project, verify that
        after having called setWorkspace on a valid but non-default 
        workspace value, the getWorkspace call correctly returns the
        newly set workspace value.
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    rally.setWorkspace(ALTERNATE_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == ALTERNATE_WORKSPACE
开发者ID:Cyrilplus,项目名称:RallyRestToolkitForPython,代码行数:16,代码来源:test_wksprj_setting.py

示例5: test_warn_on_setting_invalid_workspace

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_warn_on_setting_invalid_workspace():
    """
        Using a known valid Rally server and known valid access credentials,
        and specifying the default workspace and project, verify that
        after having called setWorkspace on an invalid workspace, that
        something like a warning occurs and that a subsequent call to
        getWorkspace returns the default workspace.
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    py.test.raises(Exception, "rally.setWorkspace('Constant Misbehavior')")
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
开发者ID:Cyrilplus,项目名称:RallyRestToolkitForPython,代码行数:16,代码来源:test_wksprj_setting.py

示例6: test_default_wksprj_with_set_non_default_workspace_specify_project_equal_None_context

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_default_wksprj_with_set_non_default_workspace_specify_project_equal_None_context():
    rally = Rally(server=AGICEN, user=AGICEN_USER, password=AGICEN_PSWD)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    project = rally.getProject()

    rally.setWorkspace(ALTERNATE_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == ALTERNATE_WORKSPACE

    url = makeResourceUrl(rally, 'Defect', project=None)
    #print(url)
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    assert expected_workspace_clause in url
    assert '&project=' not in url
开发者ID:amcolosk,项目名称:RallyRestToolkitForPython,代码行数:17,代码来源:test_context.py

示例7: test_explictly_set_workspace_as_default_context

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_explictly_set_workspace_as_default_context():
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, workspace=DEFAULT_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    project = rally.getProject()
    assert project.Name == DEFAULT_PROJECT
    url = makeResourceUrl(rally, 'Defect')
    #print(url)
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    assert expected_workspace_clause in url
    expected_project_clause = 'project=project/%s' % str(project.oid)
    assert expected_project_clause   in url

    rally.setWorkspace(ALTERNATE_WORKSPACE)
    assert rally.getWorkspace().Name == ALTERNATE_WORKSPACE
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:17,代码来源:test_workspaces.py

示例8: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [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, password, workspace, project]])
    # add in the debug=True keyword arg if you want more verbiage ...
    rally = Rally(server, user, password, workspace=workspace, project=project, debug=True) 

    workspace = rally.getWorkspace()
    print "Workspace: %s " % workspace.Name
    #print "Workspace: %12.12s   %-18.18s    (%s)" % (workspace.oid, workspace.Name, workspace.ref)

    project = rally.getProject()
    print "Project  : %s " % project.Name
    #print "Project  : %12.12s   %-18.18s    (%s)" % (project.oid, project.Name, project.ref)

    # uncomment this to see all of your accessible workspaces and projects
#    workspaces = rally.getWorkspaces()
#    for workspace in workspaces:
#        print " ", workspace.Name
#        projects = rally.getProjects(workspace=workspace.Name)
#        if projects:
#            print ""
#            print "    Projects:"
#            for project in projects:
#                print "     ", project.Name
#        else:
#            print "  No projects"
#        print ""

    sys.exit(0)
开发者ID:lenciel,项目名称:pyral,代码行数:33,代码来源:rallyfire.py

示例9: test_default_workspace_with_set_non_default_workspace_context

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_default_workspace_with_set_non_default_workspace_context():
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, workspace=DEFAULT_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    project = rally.getProject()
    assert project.Name == DEFAULT_PROJECT

    rally.setWorkspace(ALTERNATE_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == ALTERNATE_WORKSPACE

    url = makeResourceUrl(rally, 'Defect')
    #print url
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    assert expected_workspace_clause in url
    assert '&project=' not in url
开发者ID:Streeter1981,项目名称:RallyRestToolkitForPython-master,代码行数:18,代码来源:test_context.py

示例10: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [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) != 1:
        errout(USAGE)
        sys.exit(1)

    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.history.uptask")

    taskID = args.pop()   # for this example use the FormattedID
    print "attempting to update Task: %s" % taskID


    target_workspace = rally.getWorkspace()
    target_project   = rally.getProject()

    info = {
                "FormattedID"   : taskID,
                "State" : "In-Progress"
           }

##    print info   

    try:
        task = rally.update('Task', info)
    except RallyRESTAPIError, details:
        sys.stderr.write('ERROR: %s \n' % details)
        sys.exit(2)
开发者ID:nmusaelian-rally,项目名称:rally-python-api-examples,代码行数:35,代码来源:n_uptask.py

示例11: test_initial_non_default_workspace_as_isolated

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_initial_non_default_workspace_as_isolated():
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, 
                  workspace=ALTERNATE_WORKSPACE, 
                  warn=False, isolated_workspace=True)
    # Because no project=name arg was supplied, the project will be the User's default project
    # which will not necessarily be valid for the workspace argument that was supplied
    workspace = rally.getWorkspace()
    assert workspace.Name == ALTERNATE_WORKSPACE
    project = rally.getProject()
    assert project.Name == DEFAULT_PROJECT

    rally.setProject(ALTERNATE_PROJECT)
    project = rally.getProject()
    assert project.Name == ALTERNATE_PROJECT

    url = makeResourceUrl(rally, 'Defect')
    #print(url)
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    assert expected_workspace_clause in url
    expected_project_clause = 'project=project/%s' % str(project.oid)
    assert expected_project_clause   in url

    problem_text = 'No reset of of the Workspace is permitted when the isolated_workspace option is specified'
    with py.test.raises(Exception) as excinfo:
        rally.setWorkspace(DEFAULT_WORKSPACE)
    actualErrVerbiage = excinfo.value.args[0] 
    assert excinfo.value.__class__.__name__ == 'RallyRESTAPIError'
    assert actualErrVerbiage == problem_text
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:30,代码来源:test_workspaces.py

示例12: test_default_context

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_default_context():  
    """
        Using a known valid Rally server and known valid access credentials,
        obtain a Rally instance and confirm that the default workspace
        and project are set to DEFAULT_WORKSPACE and DEFAULT_PROJECT and
        that the current workspace and project are indeed the DEFAULT_WORKSPACE
        and DEFAULT_PROJECT values.
        Furthermore the construction of a GET related URL will contain
        the correct workspace and project specifications in the QUERY_STRING.
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, server_ping=False)
    context1 = rally.contextHelper.currentContext()
    workspace = rally.getWorkspace()
    project   = rally.getProject()
    context2 = rally.contextHelper.currentContext()
    assert context1 == context2
    assert context1.workspace == DEFAULT_WORKSPACE
    assert workspace.Name     == DEFAULT_WORKSPACE
    assert context1.project   == DEFAULT_PROJECT
    assert project.Name       == DEFAULT_PROJECT
    url = makeResourceUrl(rally, 'Defect')
    #print(url)
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    assert expected_workspace_clause in url
    expected_project_clause = 'project=project/%s' % str(project.oid)
    assert expected_project_clause   in url
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:28,代码来源:test_workspaces.py

示例13: test_default_isolated_workspace

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_default_isolated_workspace():  
    """
        Using a known valid Rally server and known valid access credentials,
        obtain a Rally instance and confirm that the default workspace
        and project are set to DEFAULT_WORKSPACE and DEFAULT_PROJECT and
        that the current workspace and project are indeed the DEFAULT_WORKSPACE
        and DEFAULT_PROJECT values.
        Furthermore the construction of a GET related URL will contain
        the correct workspace and project specifications in the QUERY_STRING.
        And any attempt to change the workspace via rally.setWorkspace(some_name)
        will result in a Exception being raised
    """
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, server_ping=False, isolated_workspace=True)
    context1 = rally.contextHelper.currentContext()
    workspace = rally.getWorkspace()
    project   = rally.getProject()
    context2 = rally.contextHelper.currentContext()
    assert context1 == context2
    assert context1.workspace == DEFAULT_WORKSPACE
    assert workspace.Name     == DEFAULT_WORKSPACE
    assert context1.project   == DEFAULT_PROJECT
    assert project.Name       == DEFAULT_PROJECT
    url = makeResourceUrl(rally, 'Defect')
    #print(url)
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    assert expected_workspace_clause in url

    problem_text = 'No reset of of the Workspace is permitted when the isolated_workspace option is specified'
    with py.test.raises(Exception) as excinfo:
        rally.setWorkspace(ALTERNATE_WORKSPACE)
    actualErrVerbiage = excinfo.value.args[0] 
    assert excinfo.value.__class__.__name__ == 'RallyRESTAPIError'
    assert actualErrVerbiage == problem_text
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:35,代码来源:test_workspaces.py

示例14: test_default_wksprj_with_set_workspace_with_default_context

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getWorkspace [as 别名]
def test_default_wksprj_with_set_workspace_with_default_context():
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE
    project = rally.getProject()
    assert project.Name == DEFAULT_PROJECT

    rally.setWorkspace(DEFAULT_WORKSPACE)
    workspace = rally.getWorkspace()
    assert workspace.Name == DEFAULT_WORKSPACE

    url = makeResourceUrl(rally, 'Defect')
    #print(url)
    expected_workspace_clause = 'workspace=workspace/%s' % str(workspace.oid)
    assert expected_workspace_clause in url
    expected_project_clause = 'project=project/%s' % str(project.oid)
    assert expected_project_clause   in url
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:19,代码来源:test_context.py

示例15: main

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


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