本文整理汇总了Python中tcms.management.models.TestTag.to_xmlrpc方法的典型用法代码示例。如果您正苦于以下问题:Python TestTag.to_xmlrpc方法的具体用法?Python TestTag.to_xmlrpc怎么用?Python TestTag.to_xmlrpc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tcms.management.models.TestTag
的用法示例。
在下文中一共展示了TestTag.to_xmlrpc方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tags
# 需要导入模块: from tcms.management.models import TestTag [as 别名]
# 或者: from tcms.management.models.TestTag import to_xmlrpc [as 别名]
def get_tags(request, values):
"""
Description: Get the list of tags.
Params: $values - Hash: keys must match valid search fields.
+------------------------------------------------------------+
| tag Search Parameters |
+------------------------------------------------------------+
| Key | Valid Values |
| ids | List of Integer |
| names | List of String |
+------------------------------------------------------------+
Returns: Array: An array of tag object hashes.
Example:
>>> values= {'ids': [121, 123]}
>>> Tag.get_tags(values)
"""
if values.get('ids'):
query = {'id__in': values.get('ids')}
return TestTag.to_xmlrpc(query)
elif values.get('names'):
query = {'name__in': values.get('names')}
return TestTag.to_xmlrpc(query)
else:
raise ValueError('Must specify ids or names at least.')
示例2: get
# 需要导入模块: from tcms.management.models import TestTag [as 别名]
# 或者: from tcms.management.models.TestTag import to_xmlrpc [as 别名]
def get(request, case_id):
"""
Description: Used to load an existing test case from the database.
Params: $id - Integer/String: An integer representing the ID in the database
Returns: A blessed TestCase object Hash
Example:
>>> TestCase.get(1193)
"""
try:
tc = TestCase.objects.get(case_id=case_id)
except:
raise
tc_latest_text = tc.latest_text().serialize()
response = tc.serialize()
response['text'] = tc_latest_text
#get the xmlrpc tags
tag_ids = tc.tag.values_list('id', flat=True)
query = {'id__in': tag_ids}
tags = TestTag.to_xmlrpc(query)
#cut 'id' attribute off, only leave 'name' here
tags_without_id = map(lambda x: x["name"], tags)
#replace tag_id list in the serialize return data
response["tag"] = tags_without_id
return response
示例3: get
# 需要导入模块: from tcms.management.models import TestTag [as 别名]
# 或者: from tcms.management.models.TestTag import to_xmlrpc [as 别名]
def get(request, plan_id):
"""
Description: Used to load an existing test plan from the database.
Params: $id - Integer/String: An integer representing the ID of this plan in the database
Returns: Hash: A blessed TestPlan object hash
Example:
>>> TestPlan.get(137)
"""
tp = TestPlan.objects.get(plan_id=plan_id)
response = tp.serialize()
# This is for backward-compatibility. Actually, this is not a good way to
# add this extra field. But, now that's it.
response['default_product_version'] = response['product_version']
# get the xmlrpc tags
tag_ids = tp.tag.values_list('id', flat=True)
query = {'id__in': tag_ids}
tags = TestTag.to_xmlrpc(query)
# cut 'id' attribute off, only leave 'name' here
tags_without_id = map(lambda x: x["name"], tags)
# replace tag_id list in the serialize return data
response["tag"] = tags_without_id
return response
示例4: get_tags
# 需要导入模块: from tcms.management.models import TestTag [as 别名]
# 或者: from tcms.management.models.TestTag import to_xmlrpc [as 别名]
def get_tags(request, case_id):
"""
Description: Get the list of tags attached to this case.
Params: $case_id - Integer/String: An integer representing the ID in the database
Returns: Array: An array of tag object hashes.
Example:
>>> TestCase.get_tags(12345)
"""
try:
tc = TestCase.objects.get(case_id=case_id)
except:
raise
tag_ids = tc.tag.values_list('id', flat=True)
query = {'id__in': tag_ids}
return TestTag.to_xmlrpc(query)
示例5: get_tags
# 需要导入模块: from tcms.management.models import TestTag [as 别名]
# 或者: from tcms.management.models.TestTag import to_xmlrpc [as 别名]
def get_tags(request, plan_id):
"""
Description: Get the list of tags attached to this plan.
Params: $plan_id - Integer An integer representing the ID of this plan in the database
Returns: Array: An array of tag object hashes.
Example:
>>> TestPlan.get_tags(137)
"""
try:
tp = TestPlan.objects.get(plan_id=plan_id)
except:
raise
tag_ids = tp.tag.values_list('id', flat=True)
query = {'id__in': tag_ids}
return TestTag.to_xmlrpc(query)
示例6: get_all_cases_tags
# 需要导入模块: from tcms.management.models import TestTag [as 别名]
# 或者: from tcms.management.models.TestTag import to_xmlrpc [as 别名]
def get_all_cases_tags(request, plan_id):
"""
Description: Get the list of tags attached to this plan's testcases.
Params: $plan_id - Integer An integer representing the ID of this plan in the database
Returns: Array: An array of tag object hashes.
Example:
>>> TestPlan.get_all_cases_tags(137)
"""
try:
tp = TestPlan.objects.get(plan_id=plan_id)
except:
raise
tcs = tp.case.all()
tag_ids = []
for tc in tcs.iterator():
tag_ids.extend(tc.tag.values_list('id', flat=True))
tag_ids = list(set(tag_ids))
query = {'id__in': tag_ids}
return TestTag.to_xmlrpc(query)
示例7: get_bugs
# 需要导入模块: from tcms.management.models import TestTag [as 别名]
# 或者: from tcms.management.models.TestTag import to_xmlrpc [as 别名]
in the database
Returns: Hash: A blessed TestRun object hash
Example:
>>> TestRun.get(1193)
"""
try:
tr = TestRun.objects.get(run_id=run_id)
except TestRun.DoesNotExist, error:
return error
response = tr.serialize()
# get the xmlrpc tags
tag_ids = tr.tag.values_list('id', flat=True)
query = {'id__in': tag_ids}
tags = TestTag.to_xmlrpc(query)
# cut 'id' attribute off, only leave 'name' here
tags_without_id = map(lambda x: x["name"], tags)
# replace tag_id list in the serialize return data
response["tag"] = tags_without_id
return response
@log_call(namespace=__xmlrpc_namespace__)
def get_bugs(request, run_ids):
"""
*** FIXME: BUGGY IN SERIALISER - List can not be serialize. ***
Description: Get the list of bugs attached to this run.
Params: $run_ids - Integer/Array/String: An integer representing the ID in the database
an array of integers or a comma separated list of integers.