本文整理汇总了Python中pyral.Rally.get方法的典型用法代码示例。如果您正苦于以下问题:Python Rally.get方法的具体用法?Python Rally.get怎么用?Python Rally.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyral.Rally
的用法示例。
在下文中一共展示了Rally.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bad_server_spec
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def test_bad_server_spec():
"""
Use a known to be invalid server name using prohibited characters in the
server name.
Do the same test using default access credentials and known correct
valid credentials to an existing Rally server.
The status_code in the response must indicate a non-success condition.
"""
bad_server = "ww!w.\fo,o\r\n.c%om"
expectedErrMsg = "404 Target host: '%s' doesn't support the Rally WSAPI" % bad_server
altErrText = "non-existent or unreachable"
with py.test.raises(RallyRESTAPIError) as excinfo:
rally = Rally(server=bad_server, timeout=3)
response = rally.get('Project', fetch=False, limit=10)
actualErrVerbiage = excinfo.value.args[0] # becuz Python2.6 deprecates message :-(
assert excinfo.value.__class__.__name__ == 'RallyRESTAPIError'
assert actualErrVerbiage == expectedErrMsg or altErrText in actualErrVerbiage
with py.test.raises(RallyRESTAPIError) as excinfo:
rally = Rally(server=bad_server,
user=TRIAL_USER,
password=TRIAL_PSWD, timeout=3)
response = rally.get('Project', fetch=False, limit=5)
actualErrVerbiage = excinfo.value.args[0] # becuz Python2.6 deprecates message :-(
assert excinfo.value.__class__.__name__ == 'RallyRESTAPIError'
assert actualErrVerbiage == expectedErrMsg or altErrText in actualErrVerbiage
示例2: test_bad_server_spec
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def test_bad_server_spec():
"""
Use a known to be invalid server name using prohibited characters in the
server name.
Do the same test using default access credentials and known correct
valid credentials to an existing Rally server.
The status_code in the response must indicate a non-success condition.
"""
bad_server = "ww!w.\fo,o\r\n.c%om"
expectedErrMsg = "Unknown host"
with py.test.raises(RallyRESTAPIError) as excinfo:
rally = Rally(server=bad_server, timeout=3)
response = rally.get('Project', fetch=False, limit=10)
actualErrVerbiage = excinfo.value.args[0] # becuz Python2.6 deprecates message :-(
assert excinfo.value.__class__.__name__ == 'RallyRESTAPIError'
assert 'cannot resolve' in actualErrVerbiage and 'Unknown host' in actualErrVerbiage
time.sleep(1)
with py.test.raises(RallyRESTAPIError) as excinfo:
rally = Rally(server=bad_server,
user=TRIAL_USER,
password=TRIAL_PSWD, timeout=3)
response = rally.get('Project', fetch=False, limit=5)
actualErrVerbiage = excinfo.value.args[0] # becuz Python2.6 deprecates message :-(
assert excinfo.value.__class__.__name__ == 'RallyRESTAPIError'
assert 'cannot resolve' in actualErrVerbiage and 'Unknown host' in actualErrVerbiage
time.sleep(1)
示例3: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [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, apikey, workspace, project = rallyWorkset(options)
#rally = Rally(server, user, password, apikey=apikey, workspace=workspace)
rally = Rally(server, user, password, workspace=workspace, project=project)
rally.enableLogging("rally.history.addtags")
if len(args) < 2:
print(USAGE)
sys.exit(1)
story_id = args.pop(0)
tag_names = args[:]
tags = []
story = rally.get('Story', fetch="FormattedID,Name,Description,Tags",
query="FormattedID = %s" % story_id,
server_ping=False, isolated_workspace=True, instance=True)
response = rally.get('Tag', fetch="true", order="Name", server_ping=False, isolated_workspace=True)
for tag in response:
print("Workspace %s has tag: %-14.14s created on %s Name: %s" % \
(tag.Workspace.Name, tag.oid, tag.CreationDate[:-5].replace('T', ' '), tag.Name))
if tag.Name in tag_names:
tags.append(tag)
print("=====================================================")
print(", ".join([tag.Name for tag in tags]))
adds = rally.addCollectionItems(story, tags)
print(adds)
droppable_tags = [tag for tag in tags if tag.Name == VICTIM_TAG_NAME]
print("dropping Tags %s ..." % ", ".join([tag.Name for tag in droppable_tags]))
drops = rally.dropCollectionItems(story, droppable_tags)
if drops.errors:
print("Problem attempting to drop tags: %s" % drops.errors)
sys.exit(2)
story = rally.get('Story', fetch="FormattedID,Name,Description,Tags",
query="FormattedID = %s" % story_id,
server_ping=False, isolated_workspace=True, instance=True)
#print(story.details())
print "story tags after deleting the '%s' Tag" % (droppable_tags[0].Name)
story_tags = [str(tag.Name) for tag in story.Tags]
print(story_tags)
示例4: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [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, apikey, workspace, project = rallyWorkset(options)
rally = Rally(server, user, password, apikey=apikey, workspace=workspace, project=project)
entity_name = 'Milestone'
fields = 'FormattedID,Name,TargetProject,TargetDate,TotalArtifactCount'
response = rally.get(entity_name, fetch=fields, order="TargetDate,FormattedID",
project=project, projectScopeDown=True)
if response.errors:
errout("Request could not be successfully serviced, error code: %d\n" % response.status_code)
errout("\n".join(response.errors))
sys.exit(1)
if response.resultCount == 0:
errout('No items found for %s\n' % entity_name)
sys.exit(2)
milestones = [item for item in response]
sans_project = [mi for mi in milestones if not mi.TargetProject]
with_project = [mi for mi in milestones if mi.TargetProject]
with_project.sort(key=lambda mi: mi.TargetProject.Name)
for item in (with_project + sans_project):
proj_name = item.TargetProject.Name if item.TargetProject else ""
print(" %15.15s %-6.6s %-36.36s %3d %-10.10s %s " % \
(item.oid, item.FormattedID, item.Name,
item.TotalArtifactCount, item.TargetDate, proj_name))
示例5: test_defects_revision_history
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def test_defects_revision_history():
"""
Using a known valid Rally server and known valid access credentials,
issue a simple query (no qualifying criteria) against a Rally entity
(Defect) known to have an attribute (RevisionHistory) that has an
attribute (Revisions) that is a Rally collections reference.
This test demonstrates the lazy-evaluation of non first-level attributes.
Ultimately, the attributes deeper than the first level must be obtained
and have their attributes filled out completely (_hydrated == True).
"""
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
response = rally.get('Defect', fetch=True, limit=10)
defect1 = response.next()
defect2 = response.next()
assert defect1.oid != defect2.oid
d1_revs = defect1.RevisionHistory.Revisions
d2_revs = defect2.RevisionHistory.Revisions
assert type(d1_revs) == types.ListType
assert type(d2_revs) == types.ListType
d1_rev1 = d1_revs.pop() # now the revs are in stack order, newest first, original the last
d2_rev1 = d2_revs.pop() # ditto
assert d1_rev1.RevisionNumber == 0
assert d2_rev1.RevisionNumber == 0
assert d1_rev1.Description != "" and len(d1_rev1.Description) > 0
assert d2_rev1.Description != "" and len(d2_rev1.Description) > 0
assert d1_rev1._hydrated == True
assert d2_rev1._hydrated == True
示例6: Avant_Rally
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
class Avant_Rally(object):
iterations = []
rally = None
def __init__(self, project):
self.project = project
def connect(self, username, password):
self.rally = Rally(server, user, password, project=self.project)
self.rally.enableLogging('rally.simple-use.log')
def fetch_Iterations(self):
self.iterations = []
response = self.rally.get('Iteration', fetch=True)
for rls in response:
iter = Iteration()
rlsStart = rls.StartDate.split('T')[0] # just need the date part
rlsDate = rls.EndDate.split('T')[0] # ditto
self.iterations.append(iter.set_Iteration(rlsStart, rlsDate, rls.Name, rls.PlannedVelocity, self.rally))
def display_Iterations(self):
for i in self.iterations:
print "\n\n%s %s --> %s\t" % \
(i.name, i.start_date, i.end_date)
i.display_User_Stories(i.name)
示例7: test_set_mep_project_used_as_default_in_request_operation
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def test_set_mep_project_used_as_default_in_request_operation():
"""
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.
Subsequently, set the instance's Project to a Project whose name is a duplicate.
The duplicate Project is specified as a path chain of:
baseProject // nextLevelProject // leafProject
At least one of the other non-target duplicates should exist in a shorter path.
Issue a request using the target duplicate Project m-e-p.
The result should be an Artifact whose projet matches the target duplicate Project
leaf name and ref exactly.
"""
rally = Rally(server=TRIAL, user=YETI_USER, password=YETI_PSWD,
workspace=BOONDOCKS_WORKSPACE, project=BOONDOCKS_PROJECT)
rally.setProject(DEEP_DUPE)
target_story = 'US3'
result = rally.get('Story', fetch="FormattedID,Name,Description,State,Project",
query='FormattedID = %s' % target_story,
projectScopeUp=False)
assert result is not None
assert result.resultCount > 0
stories = [story for story in result]
assert len(stories) > 0
hits = [story for story in stories if story.FormattedID == target_story]
assert len(hits) == 1
hit = hits[0]
assert hit.FormattedID == target_story
示例8: test_two_conditions_query_as_dict
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def test_two_conditions_query_as_dict():
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
qualifiers = {'State' : 'Submitted',
'Ready' : 'False'
}
response = rally.get('Defect', fetch=True, query=qualifiers, limit=10)
assert response.resultCount > 0
示例9: test_get_distant_duplicated_project
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [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
示例10: test_getAllowedValues_for_UserStory_Milestone
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def test_getAllowedValues_for_UserStory_Milestone():
"""
Using a known valid Rally server and known valid access credentials,
request allowed value information for the Milestones field of the UserStory entity.
The Milestones field is a standard field of schema type COLLECTION whose value
is entirely context dependent on the specific artifact so getting allowed values
doesn't really make sense in the same way as an attribute like State or Severity
that has a finite set of possible values that are the same for every Story or Defect
in the workspace. Because of that characteristic, we return a list with a single True
value ( [True] ) to designate that yes, technically the Milestones field has allowed
values but that asking for them on a specific AC artifact short-circuits. The proper
way to get all of the AllowedValues for Milestones is to query the Milestone entity
itself. There are numerous other standard attributes
with the same sort of semantic that are excluded from chasing the COLLECTION url and
returning some list of values. (like, Changesets, Discussions, Tags, etc.)
"""
rally = Rally(server=AGICEN, apikey=API_KEY)
avs = rally.getAllowedValues('Story', 'Milestones')
assert avs == [True]
response = rally.get('Milestone', fetch=True, workspace=LARGE_WORKSPACE,
project=LARGE_PROJECT_TREE_BASE, projectScopeDown=True)
milestones = [item for item in response]
assert len(milestones) > 150
# Given the singular name of the target field (which is invalid...) return a None value
avs = rally.getAllowedValues('Story', 'Milestone')
assert avs is None
示例11: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [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"
示例12: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [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))
示例13: get_story
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def get_story(formatted_id):
r = Rally(server, apikey=apikey, project=project)
r.enableLogging('rally.log')
aa = r.get('UserStory',
fetch=True,
query='FormattedID = "' + formatted_id + '"',
instance=True)
return dict_from_story(aa)
示例14: basic_connection
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def basic_connection():
"""
Using a known valid Rally server and access credentials, issue a simple query
request against a known valid Rally entity.
"""
rally = Rally(server=PROD, user=PROD_USER, password=PROD_PSWD)
response = rally.get('Project', fetch=False, limit=10)
print response
示例15: test_delete_pull_request
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import get [as 别名]
def test_delete_pull_request():
#rally = Rally(server=TESTN, user=TESTN_USER, password=TESTN_PSWD)
rally = Rally(server=AGICEN, apikey=AGICEN_SUB_100_API_KEY)
attrs = "ExternalId,ExternalFormattedId,Artifact,Name,Url,Description"
response = rally.get('PullRequest', fetch=attrs, project=None)
assert response.status_code == 200
assert len(response.errors) == 0
assert len(response.warnings) == 0
prs = [pr for pr in response]
assert len(prs) > 0
victim = prs[0]
result = rally.delete('PullRequest', victim.oid, project=None)
assert result == True
response = rally.get('PullRequest', fetch=attrs, query='ObjectID = %s' % victim.oid)
ghosts = [pr for pr in response]
assert not ghosts