本文整理汇总了Python中pyral.Rally.update方法的典型用法代码示例。如果您正苦于以下问题:Python Rally.update方法的具体用法?Python Rally.update怎么用?Python Rally.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyral.Rally
的用法示例。
在下文中一共展示了Rally.update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import update [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)
示例2: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import update [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)
#
# following assumes there is:
# a User in the system whose DisplayName is 'Crandall',
# a UserStory with a FormattedID of S12345,
# a Release with a name of 'April-A',
# an Iteration with a Name of 'Ivanhoe'
# within the current Workspace and Project.
#
owner_name = 'Crandall'
storyID = 'S12345'
release_target = 'April-A'
iteration_target = 'Ivanhoe'
target_workspace = rally.getWorkspace()
target_project = rally.getProject()
target_owner = rally.getUserInfo(name=owner_name).pop(0) # assume a unique match...
release = rally.get('Release', query='Name = %s' % release_target, instance=True)
iteration = rally.get('Iteration', query='Name = %s' % iteration_target, instance=True)
target_story = rally.get('UserStory', query='FormattedID = %s' % storyID, instance=True)
info = {
"Workspace" : target_workspace.ref,
"Project" : target_project.ref,
"FormattedID" : taskID,
"Name" : "Stamp logo watermark on all chapter header images",
"Owner" : target_owner.ref,
"Release" : release.ref,
"Iteration" : iteration.ref,
"WorkProduct" : target_story.ref,
"State" : "Completed",
"Rank" : 2,
"TaskIndex" : 2,
"Estimate" : 18.0,
"Actuals" : 2.5,
"ToDo" : 15.5,
"Notes" : "Bypass any GIFs, they are past end of life date",
"Blocked" : "false"
}
## print info
try:
task = rally.update('Task', info)
except RallyRESTAPIError as details:
sys.stderr.write('ERROR: %s \n' % details)
sys.exit(2)
print("Task updated")
print("ObjectID: %s FormattedID: %s" % (task.oid, task.FormattedID))
示例3: test_update_defect_in_other_project
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import update [as 别名]
def test_update_defect_in_other_project():
"""
Using a known valid Rally server and known valid access credentials,
obtain a Rally instance for the DEFAULT_WORKSPACE and DEFAULT_PROJECT.
Update the State value of a Defect identified by a FormattedID that
is associated with a non-DEFAULT_PROJECT project in the DEFAULT_WORKSPACE.
"""
rally = Rally(server=AGICEN, user=YETI_USER, password=YETI_PSWD,
workspace=DEFAULT_WORKSPACE, project=DEFAULT_PROJECT)
response = rally.get('Project', fetch=False, limit=100)
proj = response.next()
assert response.status_code == 200
assert response.errors == []
assert response.warnings == []
assert response.resultCount > 0
minimal_attrs = "ObjectID,FormattedID,CreationDate,State,ScheduleState,LastUpdateDate"
criteria = "FormattedID >= DE60"
defects = rally.get('Defect', fetch=minimal_attrs, query=criteria, project=None)
assert response.status_code == 200
assert response.errors == []
assert response.warnings == []
assert response.resultCount > 0
print("\nDefect set before updates:")
for defect in defects:
print("%s %-10.10s %-12.12s %-20.20s" % \
(defect.FormattedID, defect.State, defect.ScheduleState, defect.LastUpdateDate))
target_defect = 'DE58'
upd_info = {"FormattedID" : target_defect,
'State' : 'Fixed'
}
with py.test.raises(RallyRESTAPIError) as excinfo:
rally.update('Defect', upd_info, project='Aurora Borealis')
actualErrVerbiage = excinfo.value.args[0]
assert 'Aurora Borealis' in actualErrVerbiage
assert 'not accessible with current credentials' in actualErrVerbiage
target_defect = 'DE59'
upd_info = {"FormattedID" : target_defect,
'State' : 'Fixed'
}
with py.test.raises(Exception) as excinfo:
rally.update('Defect', upd_info, project='Bristol Bay Barons')
actualErrVerbiage = excinfo.value.args[0]
assert 'Unable to update the Defect' in actualErrVerbiage
target_defect = 'DE60'
upd_info = {"FormattedID" : target_defect,
'State' : 'Fixed'
}
result = rally.update('Defect', upd_info, project='Arctic Elevation')
assert result.State == 'Fixed'
target_defect = 'DE61'
upd_info = {"FormattedID" : target_defect,
'State' : 'Fixed'
}
result = rally.update('Defect', upd_info, project=None)
assert result.State == 'Fixed'
defects_after = rally.get('Defect', fetch=minimal_attrs, query=criteria, project=None)
print("\nDefect set after updates:")
for defect in defects_after:
print("%s %-10.10s %-12.12s %-19.19s" % \
(defect.FormattedID, defect.State, defect.ScheduleState, defect.LastUpdateDate))
print("\nReset Defect State value:")
reset_info = {'FormattedID' : 'DE60', 'State' : 'Open'}
defect = rally.update('Defect', reset_info, project='Arctic Elevation')
print("%s %s" % (defect.FormattedID, defect.State))
reset_info = {'FormattedID' : 'DE61', 'State' : 'Open'}
defect = rally.update('Defect', reset_info, project=None)
print("%s %s" % (defect.FormattedID, defect.State))
criteria = "FormattedID >= DE60"
defects_after = rally.get('Defect', fetch=minimal_attrs, query=criteria, project=None)
print("\ntarget Defects after reset:")
for defect in defects_after:
print("%s %-10.10s %-12.12s %-19.19s" % \
(defect.FormattedID, defect.State, defect.ScheduleState, defect.LastUpdateDate))
示例4: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import update [as 别名]
def main(args):
# Settings
rally_server = 'rally1.rallydev.com'
user_id = '[email protected]'
rally_password = 't0p$3cr3t'
my_workspace = 'My Workspace'
my_project = 'My Project'
weblinks_csv = 'story_weblinks.csv'
weblink_field_id = "c_MarksWeblink"
csvfile = open(weblinks_csv, "rb")
weblinksreader = csv.reader(csvfile)
# Rally Connection info
rally = Rally(rally_server, user_id, rally_password, workspace=my_workspace, project=my_project)
# Set logging
rally.enableLogging('import_weblinks.log')
# Get a handle to Rally Project
proj = rally.getProject()
# Column name to index mapping
column_name_index_lookup = {
0 : 'FormattedID',
1 : 'WebLinkID',
2 : 'WebLinkLabel'
}
rownum = 0
for row in weblinksreader:
# Save header row.
if rownum == 0:
header = row
else:
print "Importing Weblink count %d" % (rownum)
colnum = 0
for col in row:
column_name = column_name_index_lookup[colnum]
if column_name == "FormattedID":
story_formatted_id = col
elif column_name == "WebLinkID":
web_link_id = col
elif column_name == "WebLinkLabel":
web_link_label = col
colnum += 1
# Find the story to add the weblink to
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)
if response.resultCount == 0:
print "No Story %s found in Rally - No Weblink will be assigned." % (story_formatted_id)
else:
print "Story %s found in Rally - Weblink will be added." % (story_formatted_id)
story_in_rally = response.next()
story_update_data = {
"FormattedID": story_formatted_id,
weblink_field_id: {
"LinkID": web_link_id,
"DisplayString": web_link_label
}
}
try:
story_updated = rally.update('HierarchicalRequirement', story_update_data)
except Exception, details:
sys.stderr.write('ERROR: %s \n' % details)
sys.exit(1)
print "Story Updated created, ObjectID: %s FormattedID: %s" % (story_updated.oid, story_updated.FormattedID)
rownum += 1