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


Python Rally.setWorkspace方法代码示例

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


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

示例1: test_initial_non_default_workspace_as_isolated

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

示例2: test_default_wksprj_set_non_default_wksprj_specify_workspace_and_project_equal_None_context

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

示例3: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import setWorkspace [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, warn=False)
    target_workspace, byproject, art_types = processCommandLineArguments(args)
    rally.enableLogging('rally.hist.articount')  # name of file you want logging to go to
    
    workspaces = rally.getWorkspaces()
    if target_workspace != 'all':
        hits = [wksp for wksp in workspaces if wksp.Name == target_workspace]
        if not hits:
            problem = "The specified target workspace: '%s' either does not exist or is not accessible"
            errout("ERROR: %s\n" % (problem % target_workspace))
            sys.exit(2)
        workspaces = hits

    for wksp in workspaces:
        print wksp.Name
        print "=" * len(wksp.Name)
        rally.setWorkspace(wksp.Name)
        projects = [None]
        if byproject:
            projects = rally.getProjects(workspace=wksp.Name)
        for project in projects:
            if project:
                print ""
                print "    %s" % project.Name
                print "    %s" % ('-' * len(project.Name))
            for artifact_type in art_types:
                count = getArtifactCount(rally, artifact_type, project=project)
                print "       %-16.16s : %4d items" % (artifact_type, count)
        print ""
开发者ID:bimsapi,项目名称:RallyRestToolkitForPython,代码行数:36,代码来源:wkspcounts.py

示例4: test_default_wksprj_with_set_non_default_workspace_context

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

示例5: test_default_isolated_workspace

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

示例6: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import setWorkspace [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]

    server, user, password, workspace, project = rallySettings(options)
    rally = Rally(server, user, password, workspace=workspace)
    rally.enableLogging("rally.history.blddefs")

    for workspace, project in wps:
        print "workspace: %s  project: %s" % (workspace, project)
        rally.setWorkspace(workspace)
        response = rally.get('BuildDefinition', fetch=True, 
                             order='Name',
                             workspace=workspace, 
                             project=project)
        if response.errors:
            print response.errors
            sys.exit(9)

        for builddef in response:
            if builddef.Project.Name != project:
                continue
            if builddef.LastStatus == "NO BUILDS":
                print "NO BUILDS"
                continue
            #print builddef.oid, builddef.Name, builddef.LastStatus
            lbt = builddef.LastBuild.CreationDate.split('T')
            last_build_time = "%s %s" % (lbt[0], lbt[1][:5] )
            bd_name = "%-24.24s" % builddef.Name
            status  = "%-10.10s" % builddef.LastStatus
            print builddef.oid, builddef.CreationDate[:10], \
                  bd_name, status, last_build_time, len(builddef.Builds)

        print "\n"
开发者ID:M1ntcraft3r,项目名称:RallyRestToolkitForPython,代码行数:35,代码来源:builddefs.py

示例7: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import setWorkspace [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, warn=False)
    rally.enableLogging('rally.hist.articount')  # name of file you want logging to go to
    prog_opts = [opt for opt in args if opt.startswith('-')]
    byproject = False
    if '-byproject' in prog_opts:
        byproject = True
    
    #if not args:
    #    errout(USAGE)
    #    sys.exit(1)

    print ""
    workspaces = rally.getWorkspaces()
    for wksp in workspaces:
        rally.setWorkspace(wksp.Name)
        print wksp.Name
        print "=" * len(wksp.Name)
        projects = [None]
        if byproject:
            projects = rally.getProjects(workspace=wksp.Name)
        for project in projects:
            if project:
                print ""
                print project.Name
                print "    %s" % ('-' * len(project.Name))
            for artifact_type in COUNTABLE_ARTIFACT_TYPES:
                count = getArtifactCount(rally, artifact_type, project=project)
                print "       %-16.16s : %4d items" % (artifact_type, count)
        print ""
开发者ID:M1ntcraft3r,项目名称:RallyRestToolkitForPython,代码行数:36,代码来源:wkspcounts.py

示例8: main

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

示例9: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import setWorkspace [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]

    server, user, password, workspace, project = rallySettings(options)
    rally = Rally(server, user, password, workspace=workspace)
    rally.enableLogging("rally.history.blddefs")

    for workspace, project in wps:
        rally.setWorkspace(workspace)
        print "workspace: %s  project: %s\n" % (workspace, project)
        response = rally.get('BuildDefinition', fetch=True, 
                             query='Project.Name = "%s"' % project, 
                             order='Name', workspace=workspace, project=project)
        if response.errors:
            print response.errors
            sys.exit(9)

        print "%-12.12s   %-10.10s  %-36.36s %12s  %-20.20s  %s" % \
              ('BuildDef OID', 'CreateDate', 'BuildDefinition.Name', 'LastStatus', 'LastBuildDateTime', 'NumBuilds')
        print "%-12.12s   %-10.10s  %-36.36s   %10s  %-19.19s   %s" % \
              ('-' * 12, '-' * 10, '-' * 36, '-' * 10, '-' * 19, '-' * 9)
        for builddef in response:
            if builddef.LastStatus == "NO BUILDS":
                print "%s %s %-24.24s NO BUILDS" % \
                      (builddef.oid, builddef.CreationDate[:10], builddef.Name)
                continue
            lbt = builddef.LastBuild.CreationDate.split('T')
            last_build_time = "%s %s" % (lbt[0], lbt[1][:8] )
            bdf = "%12.12s   %-10.10s  %-36.36s %12s  %-20.20s    %4s"
            print bdf % (builddef.oid, builddef.CreationDate[:10], 
                  builddef.Name, builddef.LastStatus, last_build_time,
                  len(builddef.Builds))
开发者ID:bimsapi,项目名称:RallyRestToolkitForPython,代码行数:34,代码来源:builddefs.py

示例10: test_get_non_default_workspace

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

示例11: test_explictly_set_workspace_as_default_context

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

示例12: test_default_wksprj_with_set_non_default_workspace_specify_project_equal_None_context

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

示例13: test_default_workspace_with_set_non_default_workspace_context

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

示例14: test_default_wksprj_with_set_workspace_with_default_context

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

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import setWorkspace [as 别名]
def test_explictly_set_workspace_as_isolated_workspace():
    rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, workspace=DEFAULT_WORKSPACE, isolated_workspace=True)
    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)

    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,代码行数:20,代码来源:test_workspaces.py


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