本文整理汇总了Python中pyral.Rally.getUserInfo方法的典型用法代码示例。如果您正苦于以下问题:Python Rally.getUserInfo方法的具体用法?Python Rally.getUserInfo怎么用?Python Rally.getUserInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyral.Rally
的用法示例。
在下文中一共展示了Rally.getUserInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getUserInfo_query
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getUserInfo [as 别名]
def test_getUserInfo_query():
"""
Using a known valid Rally server and known valid access credentials,
request the information associated with a single username.
"""
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
qualifiers = rally.getUserInfo(username=TRIAL_USER)
assert len(qualifiers) == 1
user = qualifiers.pop()
assert user.Name == TRIAL_NICKNAME
assert user.UserName == TRIAL_USER
assert user.UserProfile.DefaultWorkspace.Name == DEFAULT_WORKSPACE
示例2: test_user_info_query
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getUserInfo [as 别名]
def test_user_info_query():
"""
Using a known valid Rally server and known valid access credentials,
request the information associated with a single username.
"""
rally = Rally(server=TRIAL, user=TRIAL_USER, password=TRIAL_PSWD)
qualifiers = rally.getUserInfo(username='[email protected]')
assert len(qualifiers) == 1
user = qualifiers.pop()
assert user.Name == 'Paul'
assert user.UserName == '[email protected]'
assert user.UserProfile.DefaultWorkspace.Name == 'User Story Pattern'
assert user.Role == 'ORGANIZER'
示例3: test_user_info_query
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getUserInfo [as 别名]
def test_user_info_query():
"""
Using a known valid Rally server and known valid access credentials,
request the information associated with a single username.
"""
rally = Rally(server=PREVIEW, user=PREVIEW_USER, password=PREVIEW_PSWD)
qualifiers = rally.getUserInfo(username='[email protected]')
assert len(qualifiers) == 1
user = qualifiers.pop()
assert user.Name == 'Paul'
assert user.UserName == '[email protected]'
assert user.UserProfile.DefaultWorkspace.Name == 'User Story Pattern'
assert user.Role == 'ORGANIZER'
ups = [up for up in user.UserPermissions]
assert len(ups) > 0
up = ups.pop(0)
assert up.Role == 'Admin'
示例4: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getUserInfo [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, version="1.30") # specify the Rally server and credentials
rally.enableLogging('rally.hist.creattach') # name of file you want logging to go to
if len(args) != 2:
errout('ERROR: You must supply an Artifact identifier and an attachment file name')
errout(USAGE)
sys.exit(1)
target, attachment_file_name = args
artifact = validateTarget(rally, target)
me = rally.getUserInfo(username=user).pop(0)
#print "%s user oid: %s" % (user, me.oid)
att = rally.addAttachment(artifact, attachment_file_name)
print "created Attachment: %s for %s" % (attachment_file_name, target)
示例5: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getUserInfo [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) != 2:
errout('ERROR: You must supply an Artifact identifier and an attachment file name')
errout(USAGE)
sys.exit(1)
target, attachment_file_name = args
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.creattach') # name of file you want logging to go to
artifact = validateTarget(rally, target)
me = rally.getUserInfo(username=user).pop(0)
#print "%s user oid: %s" % (user, me.oid)
att = rally.addAttachment(artifact, attachment_file_name)
print "created Attachment: %s for %s" % (attachment_file_name, target)
示例6: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getUserInfo [as 别名]
def main(args):
# Settings
rally_server = 'rally1.rallydev.com'
user_id = '[email protected]'
rally_password = 'topsecret'
my_workspace = 'My Workspace'
my_project = 'My Project'
jira_bugs_csv = 'jirabugs.csv'
csvfile = open(jira_bugs_csv, "rb")
bugsreader = 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_defects.log')
# Get a handle to Rally Project
proj = rally.getProject()
# Jira Severity to Rally Severity Lookup
jira2rally_sev_lookup = {
"Critical" : "Crash/Data Loss",
"Severe" : "Crash/Data Loss",
"Major" : "Major Problem",
"Minor" : "Minor Problem","Cosmetic":"Cosmetic",
"Trivial" : "Cosmetic",
"None" : "Minor Problem"
}
# Column name to index mapping
column_name_index_lookup = {0 : 'Summary',
1 : 'Priority',
2 : 'Severity',
3 : 'State',
4 : 'Description',
5 : 'Assignee',
6 : 'Submitter',
7 : 'RallyStoryID',
8 : 'JiraID'}
# get the first user whose DisplayName is 'Mark Williams'
user = rally.getUserInfo(name='Mark Williams').pop(0)
rownum = 0
for row in bugsreader:
# Save header row.
if rownum == 0:
header = row
else:
print "Importing Defect count %d" % (rownum)
colnum = 0
for col in row:
column_name = column_name_index_lookup[colnum]
if column_name == "Summary":
summary = col
elif column_name == "Priority":
priority = col
elif column_name == "Severity":
severity = jira2rally_sev_lookup[col]
elif column_name == "State":
state = col
elif column_name == "Description":
desc = col
elif column_name == "Assignee":
owner = rally.getUserInfo(name=col).pop(0)
elif column_name == "Submitter":
submitted_by = rally.getUserInfo(name=col).pop(0)
elif column_name == "RallyStoryID":
story_formatted_id = col
elif column_name == "JiraID":
jira_id = col
colnum += 1
# Find the story to parent to in Rally
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)
defect_data = {
"Project" : proj.ref,
"Name" : summary,
"Priority" : priority,
"Severity" : severity,
"State" : state,
"Description" : desc,
"ScheduleState" : "Defined",
"Owner" : owner.ref,
"SubmittedBy" : submitted_by.ref,
"JiraID" : jira_id }
if response.resultCount == 0:
print "No Story %s found in Rally - No Parent will be assigned." % (story_formatted_id)
else:
print "Story %s found in Rally - Defect will be associated." % (story_formatted_id)
story_in_rally = response.next()
#.........这里部分代码省略.........
示例7: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getUserInfo [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))
示例8: RallyClient
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getUserInfo [as 别名]
class RallyClient(object):
def __init__(self, rally_server, username, password, oauth_key):
print "Initializing RallyClient\n"
self.rally_server = rally_server
rally_url = self.rally_server['url']
credentials = CredentialsFallback(self.rally_server, username, password).getCredentials()
self.rest_api = None
self.configure_proxy()
self.rest_api = Rally(URI(rally_url), credentials['username'], credentials['password'],
apikey=oauth_key if oauth_key else self.rally_server['oAuthKey'], verify_ssl_cert=False)
@staticmethod
def create_client(rally_server, username, password, oauth_key):
print "Executing create_client() in RallyClient class in RallyClient.py\n"
return RallyClient(rally_server, username, password, oauth_key)
def configure_proxy(self):
if self.rally_server['proxyHost']:
os.environ["HTTP_PROXY"] = "http://%s:%s" % (self.rally_server['proxyHost'], self.rally_server['proxyPort'])
os.environ["HTTPS_PROXY"] = "https://%s:%s" % (self.rally_server['proxyHost'], self.rally_server['proxyPort'])
if self.rally_server['proxyUsername']:
os.environ["HTTP_PROXY"] = "http://%s:%[email protected]%s:%s" % (
self.rally_server['proxyUsername'], self.rally_server['proxyPassword'],
self.rally_server['proxyHost'],
self.rally_server['proxyPort'])
os.environ["HTTPS_PROXY"] = "https://%s:%[email protected]%s:%s" % (
self.rally_server['proxyUsername'], self.rally_server['proxyPassword'],
self.rally_server['proxyHost'],
self.rally_server['proxyPort'])
def lookup_item_by_formatted_id(self, workspace, project, type, formatted_id):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
response = self.rest_api.get(type, fetch="ObjectID", query="FormattedID = %s" % formatted_id)
if not response.errors:
print("Total results: %d\n" % response.resultCount)
result = response.next()
return result.ObjectID
else:
print("The following errors occurred: ")
for err in response.errors:
print("\t" + err)
return None
def create_sub_item(self, workspace, project, properties, user_story_formatted_id, user_story_type, property_type,
item_type):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
story_ref = self.lookup_item_by_formatted_id(workspace, project, user_story_type, user_story_formatted_id)
property_dict = dict(ast.literal_eval(properties))
property_dict[property_type] = story_ref
return self.create_item(workspace, project, property_dict, item_type)
def create_item(self, workspace, project, properties, item_type):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
item_create_response = self.rest_api.put(item_type, properties)
print "Executed successful on Rally"
return item_create_response.FormattedID
def update_item(self, workspace, project, properties, item_formatted_id, item_type):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
item_object_id = self.lookup_item_by_formatted_id(workspace, project, item_type, item_formatted_id)
property_dict = dict(ast.literal_eval(properties))
property_dict["ObjectID"] = item_object_id
update_response = self.rest_api.post(item_type, property_dict)
print "Executed successful on Rally"
return update_response.FormattedID
def query(self, workspace, project, item_type, query, fetch="True", rollupdata=False):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
response = self.rest_api.get(item_type, fetch=fetch, query=query, projectScopeDown=rollupdata)
if not response.errors:
print("Total results: %d\n" % response.resultCount)
return response
else:
print("The following errors occurred: ")
for err in response.errors:
print("\t" + err)
return None
def get_user_object_id(self, owner_username=None, owner_name=None):
response = self.rest_api.getUserInfo(username=owner_username, name=owner_name)
return response[0].ObjectID