本文整理汇总了Python中pyral.Rally.getProject方法的典型用法代码示例。如果您正苦于以下问题:Python Rally.getProject方法的具体用法?Python Rally.getProject怎么用?Python Rally.getProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyral.Rally
的用法示例。
在下文中一共展示了Rally.getProject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_named_non_default_workspace_use_default_project
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [as 别名]
def test_named_non_default_workspace_use_default_project():
"""
Using valid Rally access credentials, connect specifying
a valid non-default workspace but not specifying a project.
Return status should be OK, the Rally instance's RallyContextHelper
_inflated value should be 'narrow'
Expanded this to incorporate two scenarios
1) default project in default workspace is a valid project name
in the named non-default workspace
2) default project in default workspace is not a valid project name
in the named non-default workspace
"""
workspace = 'SCM Workspace'
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, workspace=workspace, warn=False)
ai_proj = rally.getProject()
assert str(ai_proj.Name) == 'Sample Project'
assert rally._wpCacheStatus() == 'narrow'
workspace = 'JIRA Testing'
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, workspace=workspace, warn=False)
ai_proj = rally.getProject()
assert str(ai_proj.Name) == 'GData Testing' # is valid only in 'JIRA Testing'
assert rally._wpCacheStatus() == 'narrow'
示例2: test_default_wksprj_set_non_default_wksprj_specify_workspace_and_project_equal_None_context
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [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
示例3: test_initial_non_default_workspace_as_isolated
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [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
示例4: test_named_non_default_workspace_use_default_project
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [as 别名]
def test_named_non_default_workspace_use_default_project():
"""
Using valid Rally access credentials, connect specifying
a valid non-default workspace but not specifying a project.
Return status should be OK, the Rally instance's RallyContextHelper
_inflated value should be 'narrow'
Expanded this to incorporate two scenarios
1) default project in default workspace is a valid project name
in the named non-default workspace
2) default project in default workspace is not a valid project name
in the named non-default workspace
"""
workspace = 'Foonman Internationale'
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, workspace=workspace, warn=False)
ai_proj = rally.getProject()
assert str(ai_proj.Name) == 'Shopaholic' # is valid on both default and 'Foonman Internationale'
assert rally._wpCacheStatus() == 'narrow'
workspace = 'Over Regulation Central'
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD, workspace=workspace, warn=False)
ai_proj = rally.getProject()
assert str(ai_proj.Name) == 'Picky About Lint' # is valid only in 'Wonka Factory Inspection'
assert rally._wpCacheStatus() == 'narrow'
示例5: test_named_non_default_workspace_use_default_project
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [as 别名]
def test_named_non_default_workspace_use_default_project():
"""
Using valid Rally access credentials, connect specifying
a valid non-default workspace but not specifying a project.
Return status should be OK, the Rally instance's RallyContextHelper
_inflated value should be 'narrow'
Expanded this to incorporate two scenarios
1) default project in default workspace is a valid project name
in the named non-default workspace
2) default project in default workspace is not a valid project name
in the named non-default workspace
"""
#default_workspace = 'User Story Pattern'
workspace = 'Integrations'
rally = Rally(server=PREVIEW, user=PREVIEW_USER, password=PREVIEW_PSWD, workspace=workspace)
ai_proj = rally.getProject()
assert str(ai_proj.Name) == 'Shopping Team' # is valid on both default and 'Integrations'
assert rally._wpCacheStatus() == 'narrow'
workspace = 'Healthcare Story Pattern 1'
rally = Rally(server=PREVIEW, user=PREVIEW_USER, password=PREVIEW_PSWD, workspace=workspace)
ai_proj = rally.getProject()
assert str(ai_proj.Name) == 'Big Healthcare' # is valid only in 'Healthcare Story Pattern 1'
assert rally._wpCacheStatus() == 'narrow'
示例6: test_get_distant_duplicated_project
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [as 别名]
def test_get_distant_duplicated_project():
"""
Using a known valid Rally server and known valid access credentials,
obtain a Rally instance and use it to obtain a Project instance for
a Project whose name contains multiple path elements with the elements
separated by the ' // ' token string.
Expect the result to return one and only one Project that is the correct Project.
The result should have the correct Parent Project.
When the Rally instance is called to setProject with the value of that
multi element path for the Project it should do so and should return the
correct value when asked for the current Project.
"""
rally = Rally(server=TRIAL, user=YETI_USER, password=YETI_PSWD,
workspace=BOONDOCKS_WORKSPACE, project=BOONDOCKS_PROJECT)
dupey_project = rally.getProject(DEEP_DUPE)
assert dupey_project is not None
assert dupey_project.__class__.__name__ == 'Project'
assert dupey_project.Name == DEEP_DUPE
criteria = 'Name = "%s"' % 'Corral'
expected_parent = rally.get('Project', fetch="Name,ObjectID,Parent,Children",
query=criteria, projectScopeDown=False, instance=True)
assert expected_parent is not None
assert expected_parent.__class__.__name__ == 'Project'
assert expected_parent.Name == 'Corral'
assert dupey_project.Parent.ref == expected_parent.ref
result = rally.setProject(DEEP_DUPE)
assert result is None
cur_project = rally.getProject()
assert cur_project.Name == DEEP_DUPE
示例7: test_default_wksprj_with_set_non_default_workspace_context
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [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
示例8: test_warn_on_setting_invalid_project
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [as 别名]
def test_warn_on_setting_invalid_project():
"""
Using a known valid Rally server and known valid access credentials,
and specifying the default workspace and project, verify that
after having called setProject on an invalid project, that
something like a warning occurs and that a subsequent call to
getProject returns the default project.
"""
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
project = rally.getProject()
assert project.Name == DEFAULT_PROJECT
py.test.raises(Exception, "rally.setProject('Thorny Buxcuit Weevilz')")
project = rally.getProject()
assert project.Name == DEFAULT_PROJECT
示例9: test_default_context
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [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
示例10: test_default_isolated_workspace
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [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
示例11: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [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)
示例12: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [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)
示例13: test_default_wksprj_set_non_default_wksprj_specify_workspace_and_project_equal_None_context
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [as 别名]
def test_default_wksprj_set_non_default_wksprj_specify_workspace_and_project_equal_None_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(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', workspace=None, project=None)
#print url
assert '&workspace=' not in url
assert '&project=' not in url
示例14: test_default_wksprj_with_set_non_default_workspace_and_project_specify_project_equal_None_context
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [as 别名]
def test_default_wksprj_with_set_non_default_workspace_and_project_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
rally.setProject(ALTERNATE_PROJECT)
project = rally.getProject()
assert project.Name == ALTERNATE_PROJECT
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
示例15: test_default_wksprj_specify_workspace_and_project_equal_None_context
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getProject [as 别名]
def test_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
url = makeResourceUrl(rally, 'Defect', workspace=None, project=None)
#print(url)
assert '&workspace=' not in url
assert '&project=' not in url